/* Technician PWA — mobile-first, tokens --brv2-* */

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

html,
body {
  height: 100%;
  margin: 0;
}

body.tech-app {
  font-family: var(--brv2-font-family, "Segoe UI", system-ui, sans-serif);
  font-size: var(--brv2-font-size-sm, 16px);
  line-height: var(--brv2-line-height, 1.45);
  color: var(--brv2-color-text, #1a1a1a);
  background: var(--brv2-color-bg, #eef3f8);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-height: 100dvh;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ——— Login ——— */

.tech-login {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.1rem;
  padding-top: max(1.5rem, env(safe-area-inset-top));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  background:
    radial-gradient(120% 80% at 50% -10%, #cfe3f8 0%, transparent 55%),
    linear-gradient(180deg, #e8f1fb 0%, #f4f6f8 42%, #eef3f8 100%);
}

.tech-login__card {
  width: 100%;
  max-width: 22.5rem;
  background: #fff;
  border: 1px solid #d8e2ec;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(15, 40, 70, 0.1);
  padding: 1.75rem 1.4rem 1.5rem;
}

.tech-login__kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #1b6ac9;
}

.tech-login__brand {
  margin: 0 0 0.4rem;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #12263a;
}

.tech-login__subtitle {
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
  line-height: 1.45;
  color: #5a6a7a;
}

.tech-login__hint {
  margin: 0 0 1rem;
  font-size: 0.75rem;
  color: #6b7785;
  word-break: break-all;
}

.tech-login__error {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.8rem;
  font-size: 0.875rem;
  color: #912018;
  background: #fef3f2;
  border-radius: 8px;
}

.tech-field {
  margin-bottom: 0.95rem;
}

.tech-field label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8rem;
  font-weight: 650;
  color: #243040;
}

.tech-field__help {
  margin: 0.35rem 0 0;
  font-size: 0.75rem;
  color: #6b7785;
}

.tech-field input,
.tech-field textarea {
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  font-size: 16px;
  color: #1a1a1a;
  background: #f8fafc;
  border: 1px solid #cfd8e3;
  border-radius: 10px;
}

.tech-field textarea {
  min-height: 5rem;
  resize: vertical;
}

.tech-field input:focus,
.tech-field textarea:focus {
  outline: 2px solid rgba(var(--brv2-color-accent-rgb), 0.35);
  border-color: var(--brv2-color-accent);
}

/* ——— Buttons ——— */

.tech-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: var(--brv2-touch-min);
  padding: 0.55rem 1rem;
  font: inherit;
  font-weight: 600;
  border-radius: var(--brv2-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.tech-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tech-btn--primary {
  width: 100%;
  margin-top: 0.35rem;
  min-height: 48px;
  font-size: 1rem;
  color: #fff;
  background: #1b6ac9;
  border-color: #1b6ac9;
  border-radius: 10px;
}

.tech-btn--primary:hover:not(:disabled) {
  background: var(--brv2-color-accent-dark);
}

.tech-btn--ghost {
  color: var(--brv2-color-text-secondary);
  background: transparent;
  border-color: var(--brv2-color-border);
}

.tech-btn--arrive {
  color: #fff;
  background: #0f766e;
  border-color: #0f766e;
}

.tech-btn--ok {
  color: #fff;
  background: var(--brv2-color-ok);
  border-color: var(--brv2-color-ok);
}

.tech-btn--maps {
  color: #fff;
  background: #1a73e8;
  border-color: #1a73e8;
  flex: 1;
}

.tech-btn--waze {
  color: #0a2540;
  background: #33ccff;
  border-color: #33ccff;
  flex: 1;
}

.tech-btn--link {
  width: 100%;
  margin-top: 0.5rem;
  border: none;
  background: transparent;
  color: var(--brv2-color-link);
  font-size: var(--brv2-font-size-xs);
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  min-height: auto;
  padding: 0.4rem;
}

.tech-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.tech-btn-row .tech-btn--primary {
  width: auto;
  flex: 1 1 8rem;
}

.tech-btn-row .tech-btn:not(.tech-btn--primary):not(.tech-btn--maps):not(.tech-btn--waze) {
  width: auto;
  flex: 1 1 8rem;
  color: var(--brv2-color-text-secondary, #334155);
  background: #fff;
  border-color: var(--brv2-color-border, #cfd8e3);
}

/* ——— Shell / header ——— */

.tech-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.tech-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.65rem 0.85rem;
  background: var(--brv2-color-surface);
  border-bottom: 1px solid var(--brv2-color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.tech-header__brand {
  font-weight: 700;
  font-size: var(--brv2-font-size-md);
  color: var(--brv2-color-accent);
}

.tech-header__user {
  font-size: var(--brv2-font-size-xs);
  color: var(--brv2-color-text-muted);
  margin-left: auto;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tech-header input[type='date'] {
  min-height: 2.25rem;
  padding: 0.25rem 0.4rem;
  font: inherit;
  border: 1px solid var(--brv2-color-border);
  border-radius: var(--brv2-radius-sm);
  background: var(--brv2-color-bg-muted);
}

.tech-main {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  padding-bottom: 2rem;
  -webkit-overflow-scrolling: touch;
}

.tech-status-bar {
  margin: 0 0 0.75rem;
  padding: 0.5rem 0.7rem;
  font-size: var(--brv2-font-size-xs);
  border-radius: var(--brv2-radius-sm);
  background: var(--brv2-color-accent-soft);
  color: var(--brv2-color-text-secondary);
}

.tech-status-bar--error {
  background: var(--brv2-color-danger-bg);
  color: var(--brv2-color-danger-text);
}

.tech-status-bar--ok {
  background: var(--brv2-color-ok-bg);
  color: var(--brv2-color-ok);
}

.tech-section-title {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  font-weight: 750;
}

.tech-section-sub {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--brv2-color-text-muted, #5a6a7a);
}

.tech-route {
  background: var(--brv2-color-surface, #fff);
  border: 1px solid var(--brv2-color-border, #d8e2ec);
  border-radius: var(--brv2-radius-md, 12px);
  padding: 0.85rem 0.85rem 1rem;
}

.tech-route .tech-list {
  margin: 0;
}

.tech-route .tech-visit {
  background: var(--brv2-color-bg, #f4f7fa);
}

/* ——— Map ——— */

.tech-map-panel {
  margin: 0 0 0.85rem;
  background: var(--brv2-color-surface);
  border: 1px solid var(--brv2-color-border);
  border-radius: var(--brv2-radius-md);
  overflow: hidden;
}

.tech-map-panel__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.65rem;
  border-bottom: 1px solid var(--brv2-color-border);
}

.tech-map-panel__title {
  margin: 0;
  font-size: var(--brv2-font-size-sm);
  font-weight: 700;
}

.tech-map-modes {
  display: flex;
  gap: 0.25rem;
}

.tech-map-mode {
  min-height: 36px;
  padding: 0.3rem 0.65rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--brv2-color-text-secondary);
  background: var(--brv2-color-bg-muted, #f3f5f8);
  border: 1px solid var(--brv2-color-border);
  border-radius: var(--brv2-radius-sm);
  cursor: pointer;
}

.tech-map-mode.is-active {
  color: #fff;
  background: #1b6ac9;
  border-color: #1b6ac9;
}

.tech-map {
  width: 100%;
  height: min(38vh, 220px);
  min-height: 160px;
  z-index: 1;
}

.tech-nav {
  margin-top: 0.7rem;
}

.tech-nav__label {
  margin: 0 0 0.3rem;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #1b6ac9;
}

.tech-nav .tech-btn-row {
  margin-top: 0;
}

.map-stop-icon {
  background: transparent;
  border: none;
}

.map-stop-pin {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 28px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.35);
  border: 2px solid #fff;
}

.map-stop-pin--highlight {
  border-color: #fef3c7 !important;
  border-width: 3px !important;
  box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.45), 0 2px 8px rgba(15, 23, 42, 0.4);
  font-size: 0.8125rem;
}

/* ——— Next visit highlight ——— */

.tech-next {
  background: var(--brv2-color-surface);
  border: 2px solid var(--brv2-color-accent);
  border-radius: var(--brv2-radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(var(--brv2-color-accent-rgb), 0.12);
}

.tech-next__label {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.2rem 0.55rem;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #fff;
  background: var(--brv2-color-accent);
  border-radius: var(--brv2-radius-sm);
}

.tech-next__name {
  margin: 0 0 0.25rem;
  font-size: var(--brv2-font-size-lg);
  font-weight: 700;
}

.tech-next__meta {
  margin: 0;
  font-size: var(--brv2-font-size-xs);
  color: var(--brv2-color-text-muted);
}

.tech-next__empty {
  margin: 0;
  color: var(--brv2-color-text-muted);
  font-size: var(--brv2-font-size-sm);
  display: grid;
  gap: 0.35rem;
}

.tech-next__empty strong {
  color: var(--brv2-color-text, #12263a);
  font-size: 0.95rem;
}

/* ——— Visit list ——— */

.tech-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.tech-visit {
  background: var(--brv2-color-surface);
  border: 1px solid var(--brv2-color-border);
  border-radius: var(--brv2-radius-md);
  padding: 0.85rem;
}

.tech-visit--next {
  border-color: var(--brv2-color-accent);
  background: var(--brv2-color-accent-soft);
}

.tech-visit__top {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.tech-visit__seq {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--brv2-font-size-xs);
  font-weight: 700;
  color: #fff;
  background: var(--brv2-color-accent);
  border-radius: var(--brv2-radius-pill);
}

.tech-visit__name {
  margin: 0;
  flex: 1;
  font-size: var(--brv2-font-size-md);
  font-weight: 600;
}

.tech-visit__addr {
  margin: 0 0 0.35rem;
  font-size: var(--brv2-font-size-xs);
  color: var(--brv2-color-text-muted);
}

.tech-visit__window {
  margin: 0 0 0.5rem;
  font-size: var(--brv2-font-size-xs);
  color: var(--brv2-color-text-subtle);
}

/* ——— Badges ——— */

.tech-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--brv2-radius-pill);
  white-space: nowrap;
}

.tech-badge--pending {
  color: var(--brv2-color-warn-text);
  background: var(--brv2-color-warn-bg);
}

.tech-badge--arrived {
  color: #0f766e;
  background: #ccfbf1;
}

.tech-badge--in_progress {
  color: #1557a8;
  background: var(--brv2-color-accent-soft);
}

.tech-badge--completed {
  color: var(--brv2-color-ok);
  background: var(--brv2-color-ok-bg);
}

.tech-badge--cancelled {
  color: var(--brv2-color-danger-text);
  background: var(--brv2-color-danger-bg);
}

.tech-empty {
  margin: 0;
  padding: 1.1rem 0.85rem;
  text-align: center;
  color: var(--brv2-color-text-muted);
  background: transparent;
  border: none;
  border-radius: 0;
  display: grid;
  gap: 0.35rem;
}

.tech-empty strong {
  color: var(--brv2-color-text, #12263a);
}

.tech-empty__hint {
  display: block;
  font-size: 0.8rem;
  line-height: 1.4;
  font-weight: 400;
}

.tech-gps {
  margin-top: 1rem;
  font-size: 11px;
  color: var(--brv2-color-text-subtle);
  text-align: center;
}

@media (min-width: 480px) {
  .tech-header__user {
    max-width: 14rem;
  }

  .tech-map {
    height: min(42vh, 280px);
  }
}
