:root {
  --bg: #ececed;
  --panel: #ffffff;
  --panel-soft: #f5f5f5;
  --ink: #111111;
  --muted: #707070;
  --line: #e6e6e6;
  --line-strong: #cfcfcf;
  --accent: #111111;
  --accent-deep: #333333;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
}

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

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  min-height: 100vh;
}

.auth-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-layout {
  width: min(480px, 100%);
}

.auth-card {
  background: var(--panel);
  border: 0;
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-card h2 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
  font-weight: 800;
}

.auth-copy {
  margin: 12px 0 22px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

.auth-message {
  margin: 14px 0 0;
  color: var(--muted);
  min-height: 1.4em;
  line-height: 1.5;
}

.auth-message.is-error {
  color: #7a7a7a;
}

.auth-message.is-success {
  color: #111111;
}

.auth-submit-button {
  width: 100%;
}

.app-view[hidden] {
  display: none;
}

.content-shell {
  width: min(1280px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: space-between;
  padding: 8px 0 24px;
  flex-wrap: wrap;
}

.burger-button {
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 0;
  cursor: pointer;
  flex: 0 0 auto;
}

.burger-button span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 999px;
}

.title-block h1,
.section-head h2 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.04em;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 700;
}

.panel {
  background: var(--panel);
  border: 0;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.create-section {
  display: grid;
  gap: 14px;
  justify-items: start;
}

.create-toggle-button {
  min-width: 0;
  width: fit-content;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fafafa;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.01em;
  box-shadow: none;
}

.create-form-body {
  width: 100%;
}

.create-form-body[hidden] {
  display: none;
}

.main-grid {
  display: grid;
  gap: 18px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
}

.section-copy {
  margin: 0;
  color: var(--muted);
  max-width: 42ch;
  line-height: 1.55;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.type-breakdown-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.type-breakdown-head {
  margin-bottom: 12px;
}

.type-breakdown-head h3 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
}

.type-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.type-breakdown-card {
  background: var(--panel-soft);
  border: 0;
  border-radius: 16px;
  padding: 14px;
}

.type-breakdown-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.type-breakdown-card strong {
  display: block;
  font-size: 1.1rem;
  letter-spacing: -0.03em;
}

.metric-card {
  background: var(--panel-soft);
  border: 0;
  border-radius: 16px;
  padding: 18px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.metric-card strong {
  font-size: clamp(1.4rem, 2.6vw, 2.1rem);
  letter-spacing: -0.04em;
}

.activity-form {
  display: grid;
  gap: 14px;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

label,
legend {
  font-size: 0.92rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 8px;
  border: 0;
  border-radius: 14px;
  padding: 13px 14px;
  background: #f7f7f7;
  color: var(--ink);
}

input[hidden] {
  display: none;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  background: #f1f1f1;
}

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

.staff-fieldset {
  margin: 0;
  padding: 16px;
  border: 0;
  border-radius: 16px;
  background: #fafafa;
}

.staff-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.9fr);
  gap: 14px;
}

.staff-options {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.staff-selected-panel {
  background: #fff;
  border: 1px solid #ededed;
  border-radius: 14px;
  padding: 12px;
}

.staff-selected-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.staff-selected-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.staff-selected-chip {
  display: inline-flex;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--panel-soft);
  font-size: 0.86rem;
  font-weight: 600;
}

.staff-selected-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.staff-options-help {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.staff-search {
  margin: 0 0 8px;
}

.staff-options-list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  border-radius: 14px;
  background: #f7f7f7;
}

.staff-option {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #ededed;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.staff-option:hover {
  border-color: #d9d9d9;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
}

.staff-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
}

.staff-option-text strong {
  display: block;
  font-size: 0.94rem;
  font-weight: 700;
}

.staff-option-text small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.staff-option:has(input:checked) {
  border-color: #111;
  box-shadow: 0 0 0 1px #111 inset;
  background: #fefefe;
}

.staff-option[hidden] {
  display: none;
}

.primary-button {
  border: 0;
  background: #111111;
  color: #fff;
  border-radius: 14px;
  padding: 14px 18px;
  cursor: pointer;
  width: fit-content;
  min-width: 160px;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
}

.ghost-button {
  border: 1px solid var(--line);
  background: #f2f2f2;
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 16px;
  cursor: pointer;
  width: fit-content;
}

.danger-button {
  background: #ededed;
}

.danger-button {
  background: #f4f4f4;
  border-color: var(--line-strong);
}

.topbar-session {
  margin-left: auto;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  text-align: right;
}

.topbar-session-label {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.topbar-session strong {
  display: block;
  max-width: 280px;
  overflow-wrap: anywhere;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 14px;
  margin-bottom: 16px;
}

.toolbar-field {
  display: block;
}

.table-wrap {
  overflow: auto;
  border-radius: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 14px 16px;
  border-bottom: 0;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  background: #fafafa;
}

.sort-button {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  font-weight: inherit;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 160ms ease, transform 160ms ease;
}

.sort-button:hover {
  color: var(--ink);
}

.sort-button:focus-visible {
  outline: 2px solid #111;
  outline-offset: 4px;
  border-radius: 8px;
}

.sort-arrow {
  display: inline-block;
  min-width: 0.9em;
  font-size: 0.7rem;
  line-height: 1;
  color: var(--ink);
}

td small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
}

.table-link-button {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.table-link-button:hover {
  text-decoration: underline;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f3f3f3;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 600;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.18);
  z-index: 20;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 290px;
  height: 100vh;
  background: #fff;
  box-shadow: 12px 0 40px rgba(0, 0, 0, 0.08);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  transform: translateX(-102%);
  transition: transform 220ms ease;
  z-index: 30;
}

.sidebar.is-open {
  transform: translateX(0);
}

.sidebar-head strong {
  display: block;
  font-size: 1.05rem;
  margin-top: 4px;
}

.sidebar-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 700;
}

.sidebar-foot {
  margin-top: auto;
  color: var(--muted);
  line-height: 1.55;
}

.sidebar-user-panel {
  margin-top: auto;
  padding: 16px;
  border-radius: 16px;
  background: #ffffff;
  border: 0;
}

.sidebar-user-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.sidebar-user-panel strong {
  display: block;
  margin-bottom: 14px;
  overflow-wrap: anywhere;
}

.sidebar-logout-button {
  width: 100%;
}

.sidebar-foot p {
  margin: 0 0 8px;
}

@media (max-width: 980px) {
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .staff-layout {
    grid-template-columns: 1fr;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .content-shell {
    width: min(100% - 20px, 1280px);
    padding-top: 16px;
  }

  .auth-view {
    padding: 16px;
  }

  .auth-card {
    padding: 22px;
  }

  .panel {
    padding: 18px;
  }

  .topbar {
    gap: 14px;
    padding-bottom: 18px;
  }

  .topbar-session {
    width: 100%;
    margin-left: 0;
    text-align: left;
  }

  .section-head,
  .two-columns,
  .summary-grid {
    grid-template-columns: 1fr;
    display: grid;
    align-items: start;
  }

  .section-head {
    margin-bottom: 14px;
  }

  th,
  td {
    min-width: 140px;
  }
}
