:root {
  --bg: #f7faf6;
  --surface: #ffffff;
  --surface-strong: #f0f7f1;
  --text: #14231b;
  --muted: #607069;
  --line: #dbe7de;
  --green: #136d3c;
  --green-strong: #0b4f2a;
  --gold: #c6912c;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(16, 41, 27, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 24px;
  justify-content: space-between;
  padding: 16px clamp(18px, 4vw, 56px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  align-items: center;
  color: var(--text);
  display: inline-flex;
  gap: 12px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--green);
  border-radius: var(--radius);
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  height: 42px;
  justify-content: center;
  letter-spacing: 0;
  width: 42px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  letter-spacing: 0.04em;
}

.brand small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.tabs,
.segmented {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: inline-flex;
  padding: 4px;
}

.tab,
.range-btn {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 9px 14px;
}

.tab.active,
.range-btn.active {
  background: var(--surface);
  color: var(--green-strong);
  box-shadow: 0 4px 16px rgba(17, 88, 49, 0.1);
}

main {
  padding: 34px clamp(18px, 4vw, 56px) 56px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-heading {
  align-items: end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin: 0 auto 24px;
  max-width: 1180px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.02;
}

h2 {
  font-size: 18px;
}

.page-heading p {
  color: var(--muted);
  line-height: 1.6;
  margin-top: 10px;
}

.panel,
.status-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.status-card {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  padding: 12px 14px;
  white-space: nowrap;
}

.status-card.connected {
  color: var(--green-strong);
}

.employee-grid,
.dashboard-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) 340px;
  margin: 0 auto;
  max-width: 1180px;
}

.report-form,
.guide-panel,
.toolbar,
.dashboard-grid .panel {
  padding: 22px;
}

.form-row.two,
.metric-inputs {
  display: grid;
  gap: 16px;
}

.form-row.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric-inputs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 16px 0;
}

label {
  color: var(--text);
  display: grid;
  font-size: 13px;
  font-weight: 800;
  gap: 8px;
}

input,
select,
textarea {
  background: #fbfdfb;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  min-height: 46px;
  outline: none;
  padding: 11px 12px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(19, 109, 60, 0.12);
}

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

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.primary-btn,
.ghost-btn {
  border-radius: 7px;
  font-weight: 800;
  min-height: 44px;
  padding: 0 16px;
}

.primary-btn {
  background: var(--green);
  border: 1px solid var(--green);
  color: #fff;
}

.primary-btn:hover {
  background: var(--green-strong);
}

.ghost-btn {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--green-strong);
}

.full {
  width: 100%;
}

.form-message {
  color: var(--green-strong);
  font-size: 14px;
  font-weight: 700;
  margin-top: 14px;
  min-height: 22px;
}

.form-message.error {
  color: var(--danger);
}

.guide-panel p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  margin: 10px 0 14px;
}

code {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--green-strong);
  display: block;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 14px;
  overflow-wrap: anywhere;
  padding: 12px;
}

.dashboard-heading {
  align-items: center;
}

.owner-login {
  display: flex;
  gap: 10px;
  min-width: min(420px, 100%);
}

.toolbar {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin: 0 auto 18px;
  max-width: 1180px;
}

.date-filter {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.date-filter input {
  min-width: 162px;
}

.summary-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0 auto 18px;
  max-width: 1180px;
}

.summary-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
}

.summary-card span {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 800;
}

.summary-card strong {
  display: block;
  font-size: 26px;
  margin-top: 8px;
}

.summary-card.amount strong {
  color: var(--green-strong);
}

.panel-title {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-title span {
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 680px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
  font-weight: 700;
}

.report-list {
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.report-item {
  background: #fbfdfb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px;
}

.report-item strong {
  display: block;
  font-size: 14px;
}

.report-item span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 3px;
}

.empty {
  color: var(--muted);
  font-weight: 700;
  padding: 20px 0;
}

@media (max-width: 920px) {
  .topbar,
  .page-heading,
  .toolbar,
  .dashboard-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs,
  .segmented {
    width: 100%;
  }

  .tab,
  .range-btn {
    flex: 1;
  }

  .employee-grid,
  .dashboard-grid,
  .summary-grid,
  .metric-inputs,
  .form-row.two {
    grid-template-columns: 1fr;
  }

  .date-filter,
  .owner-login {
    flex-direction: column;
    width: 100%;
  }

  .date-filter {
    align-items: stretch;
    margin-left: 0;
  }
}
