:root {
  --bg: #ffffff;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --brand: #2563eb;
  --brand-2: #f97316;
  --ok: #147c47;
  --warn: #a26700;
  --bad: #b3261e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}
button, .button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  border-radius: 7px;
  padding: 9px 14px;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
}
button.secondary { background: #fff; color: var(--brand); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 11px;
  font: inherit;
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
  outline: none;
}
textarea { min-height: 82px; resize: vertical; }
label { display: grid; gap: 6px; color: #4b5563; font-weight: 650; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.15; letter-spacing: 0; }
h1 { font-size: 26px; }
h2 { font-size: 20px; }
h3 { font-size: 15px; color: var(--muted); }
.hidden { display: none !important; }
.app:has(#loginView:not(.hidden)) .topbar { display: none; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}
.topbar strong { display: block; font-size: 16px; }
.topbar span { color: var(--muted); }
.user-chip {
  max-width: 45vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  align-self: center;
  color: var(--muted);
}
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
  background: #fff;
}
.auth-shell {
  width: min(448px, 100%);
  display: grid;
  justify-items: center;
  gap: 28px;
}
.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  color: var(--brand);
  text-decoration: none;
  font-weight: 900;
  font-size: 44px;
  line-height: 1;
  font-style: italic;
  letter-spacing: 0;
}
.brand-mark span {
  position: relative;
  display: inline-block;
  transform: skew(-8deg);
}
.brand-mark span::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 18px;
  right: -7px;
  top: -5px;
  border-radius: 5px;
  background: var(--brand-2);
}
.login-card {
  width: 100%;
  display: grid;
  gap: 16px;
  background: var(--panel);
  border: 1px solid #e7eaf0;
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .03);
}
.auth-card h1 { display: none; }
.install-card {
  width: min(640px, 100vw - 32px);
}
.install-card h1 {
  font-size: 20px;
  margin-bottom: 2px;
}
.auth-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}
.check-row {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 500;
}
.check-row input {
  width: 17px;
  height: 17px;
  padding: 0;
}
.auth-row a, .auth-footer a {
  color: #4b5563;
  text-decoration: underline;
}
.auth-actions {
  display: flex;
  justify-content: flex-end;
}
.auth-actions button {
  min-width: 82px;
  min-height: 36px;
  padding: 8px 16px;
}
.auth-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  color: #9ca3af;
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
.tabbar {
  position: sticky;
  top: 57px;
  z-index: 19;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px;
  background: #eef3f8;
  border-bottom: 1px solid var(--line);
}
.tabbar button {
  flex: 0 0 auto;
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
  min-height: 36px;
  white-space: nowrap;
}
.tabbar button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.filters {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 12px 16px 0;
  max-width: 1280px;
  margin: 0 auto;
}
.filters label { min-width: 180px; }
.content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 16px 40px;
}
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 14px;
}
.drawer {
  border-left: 5px solid var(--brand-2);
  box-shadow: 0 12px 24px rgba(23,32,51,.12);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.actions {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.summary {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  margin: 0;
}
.summary dt { color: var(--muted); font-weight: 700; }
.summary dd { margin: 0; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.mini {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfe;
}
.mini span { color: var(--muted); overflow-wrap: anywhere; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; background: #fff; }
th, td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  vertical-align: top;
}
th { background: #f0f4f8; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 8px;
}
.day {
  min-height: 100px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  display: grid;
  align-content: start;
  gap: 5px;
  background: #fff;
}
.day span {
  display: block;
  border-left: 3px solid var(--brand);
  padding-left: 6px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.day span.Rejected { border-color: var(--bad); }
.day span.Requested { border-color: var(--warn); }
.day span.Approved { border-color: var(--ok); }
.tour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}
.tour-grid label {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
}
.tour-grid small { color: var(--bad); }
.capture {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
.capture video, .capture canvas, .capture img {
  width: min(360px, 100%);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #111827;
}
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 40;
  background: #172033;
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(23,32,51,.2);
}
.muted { color: var(--muted); }
.notice { color: var(--ok); font-weight: 700; }
.error { color: var(--bad); }
@media (max-width: 760px) {
  body { font-size: 13px; }
  .topbar { padding: 10px 12px; }
  .tabbar {
    top: 53px;
    padding: 7px 8px;
  }
  .filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 10px 10px 0;
  }
  .filters label { min-width: 0; }
  .content { padding: 10px 10px 76px; }
  .grid.two, .form-grid { grid-template-columns: 1fr; }
  .panel { padding: 12px; border-radius: 8px; }
  .calendar { grid-template-columns: 1fr 1fr; }
  .day { min-height: 82px; }
  table { min-width: 680px; }
  button, .button { min-height: 38px; padding: 8px 10px; }
  .auth-shell { gap: 22px; }
  .login-card { padding: 20px; }
  .auth-row {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .auth-actions { justify-content: stretch; }
  .auth-actions button { width: 100%; }
}
