:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #65716e;
  --line: #d9e2de;
  --paper: #fbfdfb;
  --panel: #ffffff;
  --brand: #176b5c;
  --brand-dark: #0f4d42;
  --accent: #f1b24a;
  --danger: #b43b3b;
  --shadow: 0 12px 30px rgba(23, 33, 31, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #eef7f3 0, #fbfdfb 280px);
  color: var(--ink);
}

button,
select,
input {
  font: inherit;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 18px 14px;
  max-width: 880px;
  margin: 0 auto;
}

.eyebrow {
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  margin: 0 0 2px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 2rem;
  line-height: 1;
  margin-bottom: 0;
}

h2 {
  font-size: 1.05rem;
  margin-bottom: 14px;
}

main {
  width: min(100%, 880px);
  margin: 0 auto;
  padding: 0 14px 32px;
}

.toolbar,
.summary-strip,
.auth-panel,
.load-panel,
.print-details,
.session-bar,
.timesheet {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel,
.load-panel,
.print-details,
.session-bar {
  margin-bottom: 12px;
  padding: 14px;
}

.auth-panel[hidden],
.load-panel[hidden],
.print-details[hidden],
.session-bar[hidden],
.app-only[hidden] {
  display: none;
}

.auth-panel {
  margin: 28px auto 12px;
  max-width: 520px;
}

.auth-panel h2 {
  font-size: 1.35rem;
  margin-bottom: 4px;
}

.auth-panel p {
  color: var(--muted);
  margin-bottom: 12px;
}

.auth-form {
  display: grid;
  grid-template-columns: 1fr;
  align-items: end;
  gap: 12px;
}

.auth-form .add-button {
  width: 100%;
}

.auth-switch {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
  padding-top: 14px;
}

.session-bar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.session-bar span {
  color: var(--brand-dark);
  font-weight: 800;
}

.load-panel {
  align-items: end;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

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

.print-sheet {
  display: none;
}

.print-preview-mode .app-header,
.print-preview-mode .app-only,
.print-preview-mode .session-bar {
  display: none !important;
}

.print-preview-mode main {
  max-width: 8.5in;
}

.print-preview-mode .print-sheet {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: #000;
  display: block;
  font-family: Arial, Helvetica, sans-serif;
  margin: 0 auto 32px;
  padding: 16px;
}

.print-preview-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.toolbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: end;
  gap: 10px;
  padding: 12px;
}

.week-picker span,
label span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  margin-bottom: 6px;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #c9d4cf;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

input:focus,
select:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(23, 107, 92, 0.16);
}

button {
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  min-height: 44px;
}

.small-button {
  display: grid;
  place-items: center;
  width: 44px;
  background: var(--brand);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 900;
}

.icon-button {
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  min-width: 72px;
  padding: 0 14px;
}

.icon-button span {
  display: none;
}

.icon-button::after {
  content: "Print";
}

#previousWeek,
#nextWeek {
  font-size: 0;
}

#previousWeek::before,
#nextWeek::before {
  font-size: 1.35rem;
}

#previousWeek::before {
  content: "<";
}

#nextWeek::before {
  content: ">";
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 12px;
  overflow: hidden;
}

.summary-strip div {
  background: #f8fbf9;
  padding: 12px;
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.summary-strip strong {
  display: block;
  font-size: 1.45rem;
  margin-top: 2px;
}

.timesheet {
  margin-top: 12px;
  padding: 14px;
}

form label {
  display: block;
}

.form-message {
  color: var(--danger);
  min-height: 20px;
  grid-column: 1 / -1;
  margin: 0;
}

.add-button,
.ghost-button {
  padding: 0 16px;
  font-weight: 800;
}

.add-button {
  background: var(--brand);
  color: #fff;
}

.ghost-button {
  background: #e9f1ee;
  color: var(--brand-dark);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
}

.section-heading p {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 14px;
}

.day-block {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.day-block:last-child {
  border-bottom: 0;
}

.day-head,
.shift-row,
.shift-meta {
  display: flex;
  align-items: center;
}

.day-head {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.day-head h3 {
  font-size: 0.98rem;
  margin-bottom: 0;
}

.day-head strong {
  color: var(--brand-dark);
}

.shift-list {
  display: grid;
  gap: 8px;
}

.day-entry {
  display: grid;
  grid-template-columns: minmax(84px, 1fr) minmax(84px, 1fr) minmax(76px, 0.7fr) minmax(0, 1.4fr) auto auto;
  align-items: end;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.empty-day {
  color: var(--muted);
  font-size: 0.92rem;
  padding: 6px 0;
}

.shift-row {
  justify-content: space-between;
  gap: 10px;
  border-left: 4px solid var(--accent);
  background: #fffaf0;
  border-radius: 6px;
  padding: 10px;
}

.shift-row > div:first-child {
  min-width: 0;
}

.shift-time,
.shift-note {
  display: block;
}

.shift-note {
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
}

.shift-meta {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  min-width: 110px;
}

.shift-hours {
  font-weight: 900;
}

.text-button {
  min-height: 32px;
  background: transparent;
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0;
}

.text-button.danger {
  color: var(--danger);
}

@media (max-width: 520px) {
  .summary-strip strong {
    font-size: 1.2rem;
  }

  .day-entry {
    grid-template-columns: 1fr 1fr;
  }

  .load-panel {
    grid-template-columns: 1fr;
  }

  .print-details {
    grid-template-columns: 1fr;
  }

  .print-preview-actions {
    flex-direction: column;
  }

  .print-preview-actions button {
    width: 100%;
  }

  .day-entry .note-field,
  .auth-form .form-message,
  .day-entry .form-message {
    grid-column: 1 / -1;
  }

  .day-entry .add-button,
  .day-entry .ghost-button {
    width: 100%;
  }

  .section-heading,
  .shift-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .shift-meta {
    justify-content: flex-start;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-header,
  .auth-panel,
  .load-panel,
  .print-details,
  .session-bar,
  .toolbar,
  .day-entry,
  .text-button,
  .summary-strip,
  .timesheet {
    display: none !important;
  }

  main {
    max-width: none;
    padding: 0;
  }

  .print-sheet {
    color: #000;
    display: block;
    font-family: Arial, Helvetica, sans-serif;
    padding: 0.15in 0.1in;
  }

  .print-preview-actions {
    display: none !important;
  }

  .print-title {
    text-align: center;
    margin-bottom: 0.35in;
  }

  .print-title h2,
  .print-title h3 {
    font-size: 14pt;
    letter-spacing: 0;
    margin: 0 0 0.18in;
  }

  .print-line {
    align-items: baseline;
    display: flex;
    font-size: 13pt;
    gap: 8px;
    margin: 0 0 0.25in;
  }

  .print-line span,
  .print-totals span {
    border-bottom: 1px solid #000;
    flex: 1;
    min-height: 22px;
    padding-left: 8px;
  }

  .print-period {
    margin-left: 1.4in;
    max-width: 4.7in;
  }

  .print-table {
    border-collapse: collapse;
    margin-bottom: 0.28in;
    table-layout: fixed;
    width: 100%;
  }

  .print-table th,
  .print-table td {
    border: 1px solid #555;
    font-size: 11pt;
    height: 0.28in;
    padding: 4px 6px;
    text-align: left;
    vertical-align: middle;
  }

  .print-table th {
    font-weight: 800;
  }

  .weekly-print-table th:nth-child(1),
  .weekly-print-table td:nth-child(1) {
    width: 25%;
  }

  .run-print-table th {
    font-size: 9pt;
  }

  .run-print-table th:nth-child(4) {
    width: 35%;
  }

  .print-totals {
    font-size: 12pt;
    margin-top: 0.2in;
  }

  .print-totals div {
    align-items: baseline;
    display: flex;
    gap: 8px;
    margin-bottom: 0.16in;
  }

  .print-week-type {
    display: flex;
    font-size: 12pt;
    font-weight: 800;
    gap: 1.1in;
    justify-content: center;
    margin-top: 0.35in;
  }

  .print-week-type .selected {
    border: 2px solid #000;
    padding: 3px 8px;
  }
}
