:root {
  --blue: #1546c0;
  --blue-dark: #0c328f;
  --blue-soft: #e8efff;
  --ink: #142033;
  --muted: #5c6b80;
  --line: #e2e8f2;
  --bg: #ffffff;
  --wash: #f5f8fd;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 18px 50px rgba(21, 70, 192, 0.08);
  --radius: 18px;
  --petrol: #1546c0;
  --petrol-dark: #0c328f;
  --petrol-light: #3d6fe0;
  --accent: #1546c0;
  --accent-hover: #0c328f;
  --bg-card: #ffffff;
  --bg-hover: #eef3ff;
  --text-primary: #142033;
  --text-secondary: #5c6b80;
  --text-muted: #8b98ab;
  --border-color: #e2e8f2;
  --border-hover: #1546c0;
  --thead: rgba(21, 70, 192, 0.08);
  --glow-petrol: 0 8px 24px rgba(21, 70, 192, 0.18);
  --glow-petrol-strong: 0 10px 28px rgba(21, 70, 192, 0.28);
  --glow-petrol-subtle: 0 0 0 3px rgba(21, 70, 192, 0.12);
}

* { box-sizing: border-box; }

body.panel-app {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Manrope, "Segoe UI", sans-serif;
  max-width: 100%;
}

.panel-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.panel-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.panel-brand strong {
  color: var(--blue);
  font-size: 20px;
  letter-spacing: -0.03em;
}

.panel-brand span,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.panel-actions,
.row-actions,
.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.panel-btn,
.panel-app button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}

.panel-btn.secondary,
.panel-app button.secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.panel-btn.ghost {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border-color: transparent;
}

.panel-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: calc(100vh - 74px);
}

.panel-side,
.panel-main {
  padding: 24px;
}

.panel-side {
  border-right: 1px solid var(--line);
  background: var(--wash);
}

.panel-card,
.detail-card,
.login-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(21, 70, 192, 0.16), transparent 50%),
    #fff;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
}

.login-card h1 {
  margin: 0 0 6px;
  color: var(--blue-dark);
  font-size: 28px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

form[data-policy] {
  min-width: 0;
  max-width: 100%;
}

.stack[hidden],
.note[hidden] {
  display: none;
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  width: 100%;
}

textarea { min-height: 90px; resize: vertical; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--glow-petrol-subtle);
}

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

.panel-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

button.hit,
.panel-app button.hit {
  text-align: left;
  width: 100%;
  background: #fff;
  color: var(--ink);
  border: 1px solid rgba(21, 70, 192, 0.45);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  transform: none;
}

button.hit:hover,
.panel-app button.hit:hover {
  background: #fff;
  color: var(--ink);
  border-color: var(--blue);
  transform: none;
}

button.hit strong,
.panel-app button.hit strong { color: var(--ink); }

.hit strong { display: block; font-size: 16px; }
.hit-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hit-line { color: var(--muted); font-size: 13px; line-height: 1.35; }
.fold > summary { display: none; }
@media (min-width: 901px) {
  .fold:not([open]) .fold-body { display: flex; flex-direction: column; gap: 12px; }
}
@media (max-width: 900px) {
  .fold > summary {
    display: list-item;
    cursor: pointer;
    font-weight: 800;
    color: var(--blue-dark);
  }
  .fold:not([open]) .fold-body { display: none; }
  button.hit .hit-line,
  .panel-app button.hit .hit-line { display: none; }
  .note .meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    white-space: normal;
  }
  .note .meta span:not(:last-child)::after { content: none; }
}
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 700;
}
.badge.warn { background: #fff4e5; color: #9a6700; }
.badge.off { background: #f2f4f7; color: #667085; }
.note {
  border-left: 3px solid var(--blue);
  padding: 10px 12px;
  background: var(--wash);
  border-radius: 10px;
  margin-bottom: 8px;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.note .meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0;
  min-width: 0;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
  white-space: normal;
}
.note .meta span {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.note .meta span:not(:last-child)::after { content: " · "; white-space: pre; }
.split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 18px; }
.split > *,
.row-actions > *,
.stack,
label.field,
.detail-card,
.detail-card p,
.detail-card h2,
.detail-card h3 {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.portfolio {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.portfolio div {
  background: var(--blue-soft);
  border-radius: 14px;
  padding: 12px 14px;
  min-width: 140px;
}
.portfolio strong { display: block; font-size: 20px; color: var(--blue-dark); }
.error { color: var(--danger); font-size: 13px; }
.bell {
  position: relative;
}
.bell-count {
  position: absolute;
  top: -6px;
  right: -6px;
  background: var(--danger);
  color: #fff;
  border-radius: 99px;
  min-width: 18px;
  height: 18px;
  font-size: 11px;
  display: grid;
  place-items: center;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100%);
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 20px;
  overflow: auto;
  z-index: 30;
}
.nav-pills { display: flex; gap: 8px; }
.nav-pills button.active { background: var(--blue); color: #fff; }
.checkline { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 14px; }
.checkline input { width: auto; }
.panel-layout,
.panel-main,
.panel-side,
.stack,
.hit,
.detail-card {
  min-width: 0;
  max-width: 100%;
}

body.is-customer-page .panel-layout { grid-template-columns: 1fr; }
body.is-customer-page .panel-side { display: none; }

.appt-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.appt-cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

.appt-dow {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

button.appt-day {
  min-width: 0;
  min-height: 52px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-size: 12px;
  line-height: 1.2;
  overflow: hidden;
  transform: none;
  box-shadow: none;
}

button.appt-day small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  font-weight: 600;
  color: var(--blue-dark);
}

button.appt-day.outside { opacity: 0.45; }
button.appt-day.has { background: var(--blue-soft); border-color: rgba(21, 70, 192, 0.45); }
button.appt-day:hover {
  background: #fff;
  color: var(--ink);
  border-color: var(--blue);
  transform: none;
}

@media (max-width: 900px) {
  .panel-layout, .split { grid-template-columns: minmax(0, 1fr); }
  body.panel-app { overflow-x: hidden; }
  .panel-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .panel-top {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 16px;
    position: static;
  }
  .panel-actions { width: 100%; }
  .panel-actions .panel-btn,
  .panel-actions button,
  .panel-actions a {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
    text-align: center;
  }
  .panel-side, .panel-main { padding: 16px; }
  .login-wrap { padding: 16px; }
  .login-card { padding: 18px; }
  .drawer { width: 100%; border-left: 0; }
  .hit { flex-wrap: wrap; }
  .row-actions button,
  .panel-app button { white-space: normal; }
  input, select, textarea { font-size: 16px; }
  .portfolio div { min-width: 0; flex: 1 1 140px; }
  .nav-pills { flex-wrap: wrap; }
  .nav-pills button { flex: 1 1 140px; }
  .note .meta span:not(:last-child)::after { content: none; }
  form[data-policy] button { width: 100%; white-space: normal; }
}
