:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --border: #e2e4e8;
  --text: #1a1a1a;
  --muted: #6b7280;
  --accent: #AB5E6B;
  --accent-hover: #944f5b;
  --header-bg: #543049;
  --avatar-bg: #825E65;
  --error: #b91c1c;
  --success: #15803d;
  --required: #dc2626;
  --radius: 6px;
  --gap: 1rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.site-header {
  background: var(--header-bg);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-bottom: 5px solid var(--accent);
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.75rem;
}
.site-logo-link {
  display: inline-block;
  line-height: 0;
  text-decoration: none;
  justify-self: start;
}

.nav-toggle {
  display: none; /* hidden on desktop */
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0.4rem;
  border-radius: var(--radius);
  line-height: 0;
}
.nav-toggle:hover { background: rgba(255, 255, 255, 0.08); }
.nav-toggle:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.site-logo {
  display: block;
  height: 28px;
  width: auto;
}
.muted { color: var(--muted); font-size: 0.9em; }
.site-header .muted { color: rgba(255, 255, 255, 0.7); }

.header-nav {
  display: flex;
  gap: 0.25rem;
  justify-self: center;
  flex-wrap: wrap;
  justify-content: center;
}
.header-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  transition: background 0.12s ease, color 0.12s ease;
}
.header-nav a > svg {
  flex-shrink: 0;
  opacity: 0.85;
}
.header-nav a:hover > svg,
.header-nav a[aria-current="page"] > svg {
  opacity: 1;
}
.header-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.header-nav a[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-self: end;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--avatar-bg);
  color: #fff;
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  user-select: none;
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }

  .header-inner {
    /* hamburger | logo | (auto-flow right group) */
    grid-template-columns: auto auto 1fr;
    row-gap: 0.5rem;
  }

  /* Nav collapses by default on mobile */
  .header-nav {
    display: none;
    grid-column: 1 / -1;
    grid-row: 2;
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
  }
  .header-nav.is-open { display: flex; }

  .header-nav a {
    width: 100%;
    padding: 0.6rem 0.7rem;
  }
}

.signout-button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 0.45rem 0.95rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.12s ease;
}
.signout-button > svg { flex-shrink: 0; }
.signout-button:hover { background: var(--accent-hover); }
.signout-button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
}

h1 { font-size: 1.6rem; margin: 0 0 0.25rem; }
h1 + p.subtitle { color: var(--muted); margin: 0 0 1.5rem; }

.form { display: flex; flex-direction: column; gap: var(--gap); }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--gap);
}
label { font-weight: 500; font-size: 0.95rem; }
.required::after { content: ' *'; color: var(--required); }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}
textarea { min-height: 80px; resize: vertical; }
.long-textarea { min-height: 120px; }

.checkbox-field {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
}
.checkbox-field input { width: auto; margin: 0; }
.checkbox-field label { font-weight: 400; }

.button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 0.65rem 1.25rem;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
.button:hover { background: var(--accent-hover); }
.button:disabled { opacity: 0.6; cursor: not-allowed; }
.button-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}
.button-secondary:hover { background: var(--bg); }

.button-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.conditional {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  margin-left: 0.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.login-card {
  max-width: 380px;
  margin: 4rem auto 0;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}
.alert-error {
  background: #fee2e2;
  color: var(--error);
  border: 1px solid #fca5a5;
}
.alert-success {
  background: #dcfce7;
  color: var(--success);
  border: 1px solid #86efac;
}
.alert-warning {
  background: #fef3c7;
  color: #854d0e;
  border: 1px solid #fcd34d;
}
/* Tighten alerts that sit inside a flex-gap field, so the gap isn't doubled. */
.field > .alert { margin-bottom: 0; }

.help-text {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.field-error {
  font-size: 0.85rem;
  color: var(--error);
  margin: 0.25rem 0 0;
}
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: var(--error);
}
input[aria-invalid="true"]:focus,
select[aria-invalid="true"]:focus,
textarea[aria-invalid="true"]:focus {
  outline-color: var(--error);
  border-color: var(--error);
}

hr.section-break {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0 0.5rem;
}

/* --- /report 2-column layout with sidebar --- */

.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1.5rem;
  align-items: start;
}

.report-main { min-width: 0; }

@media (max-width: 768px) {
  .report-layout { grid-template-columns: 1fr; }
}

.sidebar {
  position: sticky;
  top: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.sidebar-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.15rem;
}
.sidebar-subtitle { margin: 0 0 0.75rem; font-size: 0.8rem; }
.sidebar-empty { font-size: 0.85rem; margin: 0; }

.log-card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.log-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem;
  background: var(--bg);
  font-size: 0.85rem;
  line-height: 1.4;
}
.log-card-time {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.log-card-skill { font-weight: 600; }
.log-card-problem { color: var(--muted); font-size: 0.8rem; }
.log-card-summary { margin: 0.35rem 0 0; }
