:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #697586;
  --line: #d9dee7;
  --accent: #7c3aed;
  --accent-dark: #6d28d9;
  --soft: #f5f3ff;
  --success: #059669;
}

[hidden] { display: none !important; }
* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  height: 100%;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; }

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  min-height: 34px;
  padding: 0 12px;
}

button:hover { border-color: var(--accent); color: var(--accent-dark); }
button:disabled { opacity: 0.4; pointer-events: none; }
.btn-complete { background: var(--success); border-color: var(--success); color: #fff; }
.btn-complete:hover { background: #047857; border-color: #047857; color: #fff; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface, #fff);
  flex-wrap: wrap;
  flex-shrink: 0;
}
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

h1, h2, p { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }

.tech-name { font-size: 13px; font-weight: 700; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.workspace { padding: 12px; display: flex; flex: 1; min-height: 0; flex-direction: column; overflow: hidden; }
.status-bar { color: var(--muted); font-size: 13px; flex-shrink: 0; margin-bottom: 8px; }

.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.job-list {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-y: auto;
  min-height: 0;
}

.job-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.1s;
}

.job-row:hover { background: var(--soft); }
.job-row.active { background: var(--soft); border-left: 3px solid var(--accent); }
.job-row:last-child { border-bottom: 0; }

.job-row-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.job-row-customer { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job-row-sub { font-size: 12px; color: var(--muted); display: flex; gap: 8px; }
.job-tech { color: var(--accent); }
.status-badge { font-size: 11px; font-weight: 700; text-transform: uppercase; white-space: nowrap; }
.priority-dot { font-size: 11px; font-weight: 700; }

.job-detail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
}

.detail-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.status-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.priority-badge { font-size: 12px; font-weight: 700; text-transform: uppercase; }
.detail-customer { color: var(--muted); font-size: 13px; margin-top: 4px; }
.detail-unit { font-size: 13px; color: var(--ink); background: var(--soft); padding: 8px 12px; border-radius: 6px; font-weight: 600; }

.detail-section { display: flex; flex-direction: column; gap: 6px; }
.section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.detail-text { white-space: pre-wrap; line-height: 1.6; }
.detail-dates { font-size: 13px; color: var(--muted); line-height: 1.8; }

.part-row { font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.part-row:last-child { border-bottom: 0; }

.grid { display: grid; gap: 10px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 36px;
  padding: 6px 10px;
  text-transform: none;
  font-size: 14px;
}

textarea { resize: vertical; }

.save-row { display: flex; align-items: center; gap: 10px; }
#saveStatus { font-size: 12px; color: var(--muted); }

.btn-sm { padding: 0 8px; min-height: 26px; font-size: 12px; }
.detail-meta-row { font-size: 12px; color: var(--muted); margin-bottom: 2px; }

.tt-section { display: flex; flex-direction: column; gap: 8px; }
.tt-header { display: flex; align-items: center; justify-content: space-between; }
.tt-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tt-row-header { display: flex; align-items: center; gap: 8px; }
.tt-number { font-size: 11px; font-weight: 700; font-family: monospace; color: var(--accent); flex: 1; }
.tt-remove { min-height: 22px; padding: 0 6px; font-size: 13px; color: var(--muted); }
.tt-row-fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.tt-row-fields label { font-size: 11px; }
.tt-row-fields input { font-size: 13px; }
.tt-notes { width: 100%; font-size: 13px; resize: vertical; }
.tt-total-summary { font-size: 12px; font-weight: 600; color: var(--muted); text-align: right; padding: 4px 0; }

#emptyJobs { text-align: center; color: var(--muted); padding: 32px 16px; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; overflow-y: auto; }
  .job-list { min-height: 240px; max-height: 280px; }
  .grid.two { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: stretch; }
}

/* SSO banner styling */
.sso-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.sso-avatar {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: #ddd;
}
.sso-name { font-weight: 600; font-size: 14px; }

/* Permission notice banner styling */
.permission-notice {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: #fff3cd;
  border-bottom: 1px solid #f1d90e;
  padding: 10px 16px;
  z-index: 1000;
  display: flex;
  justify-content: center;
}
.permission-content {
  max-width: 1000px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.permission-content strong { font-weight: 700; }
.permission-content button { margin-left: auto; background: #0078d7; color: white; border: none; padding: 6px 12px; border-radius: 6px; cursor: pointer; }

/* ── Landing page styles ── */
.landing-wrap { max-width: 900px; margin: 0 auto; padding: 48px 24px 32px; }
.landing-hero { margin-bottom: 40px; }
h1 { margin: 0 0 10px; font-size: 28px; }
.landing-sub { color: var(--muted); font-size: 16px; margin-top: 6px; max-width: 520px; }
.landing-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 24px; }
.btn-signin { display: inline-block; padding: 10px 28px; background: var(--accent); color: #fff;
  border-radius: 8px; font-size: 15px; font-weight: 700; text-decoration: none; }
.btn-signin:hover { background: var(--accent-dark); }
.btn-hub { display: inline-block; padding: 10px 20px; background: transparent; color: var(--muted);
  border-radius: 8px; font-size: 14px; font-weight: 600; text-decoration: none; border: 1px solid var(--line); }
.btn-hub:hover { border-color: var(--accent); color: var(--accent-dark); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.feature-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px 18px; }
.feature-card svg { width: 26px; height: 26px; stroke: var(--accent); fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; margin-bottom: 12px; }
.feature-card h3 { margin: 0 0 4px; font-size: 14px; }
.feature-card p { margin: 0; color: var(--muted); font-size: 13px; }
.landing-footer { text-align: center; padding: 24px 16px; font-size: 12px; color: var(--muted); }
.landing-footer a { color: inherit; text-decoration: underline; }

#statusBar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 150; border-top: 1px solid var(--border); border-bottom: none !important; }
