:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #1d2023;
  --panel-2: #25292d;
  --line: #3a4148;
  --text: #f4f1ea;
  --muted: #a9afb5;
  --green: #45d06f;
  --cyan: #30c2cf;
  --red: #d24b57;
  --amber: #e4aa22;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.36);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
}

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

.app-shell {
  position: relative;
  width: min(100vw, 560px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 14px calc(88px + env(safe-area-inset-bottom));
  background:
    radial-gradient(circle at 24% -8%, rgba(48, 194, 207, 0.14), transparent 32%),
    linear-gradient(180deg, #17191c 0%, #111315 58%);
}

.topbar,
.month-toolbar,
.section-head,
.modal-head,
.report-actions,
.top-actions,
.month-actions,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar {
  min-height: 62px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 24px;
  line-height: 1;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.1;
}

.icon-btn,
.ghost {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 24px;
  font-weight: 700;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 14px 0;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: #171a1d;
}

.tab {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tab.active {
  background: #2a3035;
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.scope-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0 0 12px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: #171a1d;
}

.scope-btn {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.scope-btn.active {
  background: rgba(48, 194, 207, 0.18);
  color: var(--text);
}

.report-controls {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

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

.money-hidden .money-sensitive,
.money-hidden .day-income {
  filter: blur(7px);
  opacity: 0.42;
}

.money-hidden .day-income {
  user-select: none;
}

.privacy-on {
  background: rgba(210, 75, 87, 0.18);
  color: #ff8795;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.month-toolbar {
  margin: 16px 0 12px;
}

.year-label {
  margin: 0 0 2px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

#monthLabel {
  min-width: 168px;
  text-align: center;
  text-transform: uppercase;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.metric {
  min-height: 70px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.weekday-grid,
.calendar-grid {
  display: grid;
  grid-template-columns: 34px repeat(7, minmax(0, 1fr));
}

.weekday-grid span {
  padding: 9px 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  background: #22262a;
  color: var(--muted);
  text-align: center;
  font-size: 12px;
  font-weight: 900;
}

.day-cell {
  position: relative;
  min-height: 78px;
  padding: 6px 5px;
  border: 1px solid var(--line);
  background: #202326;
  color: var(--muted);
  text-align: left;
}

.day-cell.outside {
  background: #151719;
  opacity: 0.45;
}

.day-cell.selected {
  outline: 2px solid var(--red);
  outline-offset: -2px;
}

.day-num {
  position: absolute;
  top: 5px;
  right: 6px;
  font-size: 12px;
}

.day-hours {
  display: block;
  margin-top: 19px;
  color: #ff5e7a;
  text-align: center;
  font-size: 23px;
  font-weight: 900;
}

.day-income {
  display: block;
  margin-top: 2px;
  color: #29a64f;
  font-size: 12px;
  font-weight: 800;
}

.day-job {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 6px;
  background: var(--cyan);
}

.section-head {
  margin: 18px 0 12px;
}

.primary,
.secondary,
.danger {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: var(--text);
  font-weight: 900;
}

.primary {
  background: linear-gradient(135deg, #28b8c6, #248991);
  box-shadow: 0 14px 28px rgba(32, 184, 198, 0.18);
}

.secondary {
  background: #353b41;
}

.danger {
  background: #953943;
}

.small {
  min-height: 40px;
  padding: 0 14px;
  font-size: 13px;
}

.card-list {
  display: grid;
  gap: 10px;
}

.job-card,
.expense-card,
.report-card {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.job-card {
  display: grid;
  gap: 8px;
}

.card-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(69, 208, 111, 0.14);
  color: #78e893;
  font-size: 12px;
  font-weight: 900;
}

.muted {
  color: var(--muted);
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #111315;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--green);
}

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

.report-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.week-label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-right: 0;
  background: #171a1d;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
}

.work-lines-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.work-lines {
  display: grid;
  gap: 10px;
}

.work-line {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.work-line-top {
  display: grid;
  grid-template-columns: 88px 1fr 44px;
  gap: 8px;
  align-items: end;
}

.work-line .ghost {
  width: 44px;
}

.task-template {
  border-color: rgba(48, 194, 207, 0.34);
  background: #20262a;
  color: var(--cyan);
  font-weight: 900;
}

.photo-box {
  display: grid;
  gap: 10px;
}

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

.photo-item {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.photo-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 7px;
}

.photo-item textarea {
  min-height: 58px;
}

.report-actions {
  margin-top: 14px;
}

.fab {
  position: fixed;
  right: max(18px, calc((100vw - 560px) / 2 + 18px));
  bottom: max(22px, env(safe-area-inset-bottom));
  width: 60px;
  height: 60px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #45d06f, #24a555);
  color: #07130b;
  font-size: 34px;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.modal {
  width: min(92vw, 520px);
  max-height: 88vh;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

.modal form {
  display: grid;
  gap: 13px;
  padding: 18px;
}

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

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 22px;
  min-height: 22px;
  accent-color: var(--cyan);
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  padding: 10px 12px;
  background: #171a1d;
  color: var(--text);
}

textarea {
  resize: vertical;
}

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

.color-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.color-swatch {
  width: 42px;
  height: 42px;
  border: 2px solid transparent;
  border-radius: 8px;
}

.color-swatch.active {
  border-color: #fff;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 390px) {
  .app-shell {
    padding-left: 10px;
    padding-right: 10px;
  }

  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .day-cell {
    min-height: 70px;
  }

  .tab {
    font-size: 12px;
  }

  .report-options {
    grid-template-columns: 1fr;
  }
}
