/* Bright, bold, high-contrast — color/type language borrowed from
   Indian quick-commerce apps (bold yellow chrome, black text, green
   for go/confirm actions), applied to an industrial ops tool. Light
   background reads well in direct daylight, which a dark theme does
   not. One-handed use on a 5.5" phone. */

:root {
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-hover: #f1f1ef;
  --border: #e8e7e2;
  --border-strong: #d8d7d0;
  --text: #14140f;
  --text-dim: #63625a;
  --text-faint: #99988e;

  --accent: #ffc633;
  --accent-hover: #ffd35c;
  --accent-text: #17130a;
  --accent-soft: #fff3d2;

  --primary: #0c9d61;
  --primary-hover: #0bb26e;
  --primary-text: #ffffff;
  --primary-soft: #e3f7ec;

  --danger: #e0393f;
  --danger-bg: #fdeaea;
  --danger-border: #f6c4c5;
  --ok: #0c9d61;
  --ok-bg: #e3f7ec;
  --info: #2e6ff6;
  --info-bg: #e9f0ff;

  --ink: #14140f;

  --tap-min: 52px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 15, 0.06);
  --shadow-md: 0 10px 24px -8px rgba(20, 20, 15, 0.12), 0 2px 6px rgba(20, 20, 15, 0.05);
  --shadow-lg: 0 24px 48px -12px rgba(20, 20, 15, 0.28);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body { padding-bottom: 64px; }

h1, h2, h3 { font-weight: 800; letter-spacing: -0.01em; margin: 0; color: var(--ink); }

h1 { font-size: 1.375rem; margin: 0 0 0.4em; }

h2 {
  font-size: 0.74rem;
  margin: 1.75em 0 0.6em;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}
h2::before {
  content: "";
  width: 4px;
  height: 13px;
  background: var(--primary);
  border-radius: 3px;
  display: inline-block;
}
h2:first-child { margin-top: 0; }

/* ---------------------------------------------------------------- */
/* Top bar + nav                                                     */
/* ---------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--accent);
  border-bottom: 1px solid rgba(20, 20, 15, 0.08);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar .title { font-weight: 800; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--accent-text); }

.lang-toggle {
  display: inline-flex;
  background: rgba(20, 20, 15, 0.1);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}
.lang-btn {
  min-height: 26px;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 800;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--accent-text);
  opacity: 0.55;
}
.lang-btn.active { background: var(--ink); color: var(--accent); opacity: 1; }

.net-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 5px 10px 5px 8px;
  border-radius: 999px;
  background: rgba(20, 20, 15, 0.1);
  color: var(--accent-text);
}
.net-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); flex: none; }
.net-status.online .dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(12, 157, 97, 0.25); }

.nav-toggle-btn {
  width: 40px; height: 40px; min-height: 40px; padding: 0;
  border-radius: 999px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 20, 15, 0.1); border: none; color: var(--accent-text);
}
.nav-toggle-btn svg { width: 20px; height: 20px; }

.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 20, 15, 0.45);
  z-index: 70;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer-panel {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: 80%; max-width: 300px;
  background: var(--surface);
  z-index: 71;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.drawer-panel.open { transform: translateX(0); }

.drawer-header { padding: 22px 18px 18px; background: var(--accent); flex: none; }
.drawer-header .brand-mark {
  width: 40px; height: 40px; margin: 0 0 10px; color: var(--accent-text);
  background: rgba(20, 20, 15, 0.12); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}
.drawer-header .brand-mark svg { width: 22px; height: 22px; }
.drawer-header .drawer-company { font-weight: 800; font-size: 1rem; color: var(--accent-text); }
.drawer-header .drawer-location { font-size: 0.78rem; color: var(--accent-text); opacity: 0.75; font-weight: 600; margin-top: 1px; }

.drawer-nav { padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.drawer-nav a {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px; border-radius: 12px;
  color: var(--text-dim); text-decoration: none;
  font-weight: 700; font-size: 0.92rem;
}
.drawer-nav a .nav-icon { width: 20px; height: 20px; flex: none; display: flex; }
.drawer-nav a .nav-icon svg { width: 100%; height: 100%; }
.drawer-nav a:active { background: var(--surface-hover); }
.drawer-nav a.active { background: var(--primary-soft); color: var(--primary); }

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 14px 40px;
}

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: none;
  padding: 24px;
  background: var(--bg);
}
.login-card { width: 100%; max-width: 380px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 28px; }
.brand-mark {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent);
  border-radius: var(--radius);
  color: var(--ink);
  box-shadow: var(--shadow-md);
}
.brand-mark svg { width: 30px; height: 30px; }
.brand-name { font-weight: 800; font-size: 1.1rem; letter-spacing: -0.01em; color: var(--ink); }
.login-card h1 { text-align: center; font-size: 1.2rem; color: var(--ink); font-weight: 800; margin-bottom: 1em; }

/* ---------------------------------------------------------------- */
/* Cards + layout primitives                                         */
/* ---------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

label {
  display: block;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 6px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* ---------------------------------------------------------------- */
/* Form controls                                                     */
/* ---------------------------------------------------------------- */

input, select, textarea {
  width: 100%;
  min-height: var(--tap-min);
  font-size: 1.05rem;
  font-family: inherit;
  padding: 10px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  margin-bottom: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input::placeholder { color: var(--text-faint); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input[type="number"] { font-variant-numeric: tabular-nums; }
select { appearance: none; background-color: var(--bg); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M5.5 8l4.5 4.5L14.5 8' stroke='%2363625a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; }

.stepper {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 12px;
}
.stepper input {
  text-align: center;
  margin-bottom: 0;
  flex: 1;
  font-weight: 800;
}
.stepper button {
  width: var(--tap-min);
  min-height: var(--tap-min);
  font-size: 1.4rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  padding: 0;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 12px;
}
.chip {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg);
  border: 1.5px solid var(--border-strong);
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 700;
}
.chip.selected { border-color: var(--primary); color: var(--primary-text); background: var(--primary); }

/* ---------------------------------------------------------------- */
/* Buttons                                                            */
/* ---------------------------------------------------------------- */

button {
  cursor: pointer;
  background: var(--surface-hover);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  min-height: var(--tap-min);
  padding: 10px 18px;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 700;
}
button:hover { filter: brightness(0.97); }

button.primary {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
  width: 100%;
  font-size: 1.05rem;
  font-weight: 800;
  box-shadow: 0 6px 16px -4px rgba(12, 157, 97, 0.45);
}
button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

button.secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
button.secondary:hover { border-color: var(--text-dim); }

button.danger { border-color: var(--danger-border); color: var(--danger); background: var(--surface); }
button.danger:hover { background: var(--danger-bg); }

/* ---------------------------------------------------------------- */
/* Repeatable rows                                                    */
/* ---------------------------------------------------------------- */

.repeatable-row {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.repeatable-row:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.repeatable-row > select { width: 100%; margin-bottom: 10px; }
.repeatable-row .row-controls {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.repeatable-row .row-controls > * { flex: 1; margin-bottom: 0; }
.repeatable-row .row-controls .stepper { margin-bottom: 0; flex: 1; }
.repeatable-row .remove-btn {
  min-height: var(--tap-min);
  width: 48px;
  flex: 0 0 48px;
  color: var(--danger);
  border-color: var(--border-strong);
  background: var(--surface);
  padding: 0;
}
.repeatable-row .remove-btn:hover { background: var(--danger-bg); border-color: var(--danger-border); }

/* ---------------------------------------------------------------- */
/* Feedback: banners, badges, sync list                               */
/* ---------------------------------------------------------------- */

.warning-banner {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: #a3242a;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.5;
}
.warning-banner button { margin-top: 10px; }

.sync-list { display: flex; flex-direction: column; gap: 8px; }
.sync-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  border-left: 4px solid var(--border-strong);
  font-size: 0.9rem;
}
.sync-item.pending { border-left-color: var(--accent); }
.sync-item.syncing { border-left-color: var(--info); }
.sync-item.synced { border-left-color: var(--ok); }
.sync-item.blocked { border-left-color: var(--danger); }

.badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.pending { background: var(--accent-soft); color: #8a5a00; }
.badge.syncing { background: var(--info-bg); color: var(--info); }
.badge.synced { background: var(--ok-bg); color: var(--ok); }
.badge.blocked { background: var(--danger-bg); color: var(--danger); }

/* ---------------------------------------------------------------- */
/* Modals                                                             */
/* ---------------------------------------------------------------- */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 20, 15, 0.45);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  z-index: 50;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.help-text { color: var(--text-faint); font-size: 0.82rem; margin-top: -8px; margin-bottom: 12px; line-height: 1.5; }

.readonly-value {
  min-height: var(--tap-min);
  display: flex; align-items: center;
  padding: 10px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  margin-bottom: 12px;
  font-weight: 700;
}

/* ---------------------------------------------------------------- */
/* Motion — purposeful, not decorative. Native smooth scroll instead   */
/* of a scroll-hijacking library: an operator dragging a form with     */
/* gloves needs the scroll to go exactly where the finger goes.        */
/* ---------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  @keyframes rise-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
  @keyframes pop-in {
    0% { opacity: 0; transform: scale(0.7); }
    65% { opacity: 1; transform: scale(1.08); }
    100% { transform: scale(1); }
  }
  @keyframes modal-rise {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
  }
  @keyframes pulse-ring {
    0%, 100% { box-shadow: 0 0 0 0 rgba(12, 157, 97, 0.35); }
    50% { box-shadow: 0 0 0 4px rgba(12, 157, 97, 0); }
  }
  @keyframes shake-x {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-4px); }
    40%, 60% { transform: translateX(4px); }
  }

  .card, .repeatable-row, .sync-item { animation: rise-in 0.35s cubic-bezier(0.16, 1, 0.3, 1) both; }
  .warning-banner { animation: shake-x 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
  .badge { animation: pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
  .modal-overlay { animation: fade-in 0.18s ease both; }
  .modal { animation: modal-rise 0.28s cubic-bezier(0.16, 1, 0.3, 1) both; }
  .net-status.online .dot { animation: pulse-ring 2.2s ease-in-out infinite; }
  .chip, button { transition: transform 0.12s ease, filter 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease; }

  @keyframes success-flash {
    0% { box-shadow: 0 0 0 0 rgba(12, 157, 97, 0.55); }
    100% { box-shadow: 0 0 0 14px rgba(12, 157, 97, 0); }
  }
  button.primary.success-pulse { animation: success-flash 0.6s ease-out; }
}

button:active, .chip:active { transform: scale(0.96); }
.stepper button:active { transform: scale(0.9); }
