:root {
  --olive: #496a32;
  --olive-dark: #29461f;
  --paper: #eef8ea;
  --ink: #182116;
  --muted: #53604f;
  --line: #9bad91;
  --blue: #76c7dd;
  --yellow: #edcc43;
  --orange: #ff8b1f;
  --red: #d44040;
  --black: #101612;
  --white: #f7faf5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 18px;
}

.phone-surface {
  width: min(100%, 1760px);
  min-height: calc(100vh - 36px);
  background: #f7fbf4;
  border: 1px solid #d6dfcf;
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(23, 35, 20, 0.12);
  overflow: auto;
}

.wide-surface {
  width: 100%;
}

.screen {
  min-height: calc(100vh - 38px);
  padding: 22px;
}

.login-screen {
  display: grid;
  place-items: center;
  background: var(--paper);
}

.invite-login-screen {
  align-items: start;
  place-items: start center;
}

.login-card {
  width: min(100%, 420px);
  display: grid;
  gap: 14px;
}

.brand {
  margin: 0 0 4px;
  font-size: 34px;
  line-height: 1;
}

.subtitle {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.35;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 650;
}

.field input {
  width: 100%;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.field input:focus {
  border-color: #167061;
}

.primary-button,
.ghost-button {
  min-height: 46px;
  border-radius: 999px;
  border: 2px solid var(--olive);
  padding: 0 18px;
  font-weight: 750;
}

.primary-button {
  background: #167061;
  color: #fff;
}

.ghost-button {
  background: transparent;
  color: var(--olive-dark);
}

.top-line {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.top-line h1 {
  margin: 0;
  font-size: clamp(24px, 7vw, 40px);
  line-height: 1.05;
}

.small-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(73, 106, 50, 0.45);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--olive-dark);
  font-weight: 900;
}

.add-button {
  background: var(--olive);
  color: #fff;
  border-color: var(--olive-dark);
  font-size: 28px;
  line-height: 1;
}

.quick-add {
  position: relative;
}

.quick-menu {
  position: absolute;
  z-index: 30;
  top: 48px;
  right: 0;
  width: min(260px, calc(100vw - 28px));
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.quick-menu button {
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  font-weight: 650;
}

.home-header {
  display: grid;
  grid-template-columns: 1fr 132px;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.home-desktop-grid {
  display: block;
}

.logo-box,
.enterprise-box {
  border: 3px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.48);
  overflow: hidden;
}

.logo-box {
  min-height: 118px;
  display: grid;
  place-items: center;
}

.logo-box img {
  display: block;
  max-width: 100%;
  max-height: 118px;
  object-fit: contain;
}

.logo-placeholder {
  font-size: 28px;
  font-weight: 800;
  color: var(--olive);
}

.enterprise-box {
  min-height: 132px;
  display: grid;
  place-items: center;
  padding: 8px;
  background: #aebda3;
  color: white;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.35);
  font-weight: 900;
}

.enterprise-box img {
  max-width: 100%;
  max-height: 86px;
  object-fit: contain;
}

.company-name {
  margin: 0 0 14px;
  text-align: center;
  font-size: clamp(20px, 5.8vw, 32px);
  line-height: 1.05;
  font-weight: 850;
}

.company-switcher {
  position: relative;
}

.company-list {
  position: absolute;
  z-index: 20;
  top: 48px;
  right: 0;
  width: min(360px, calc(100vw - 44px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.company-list button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  text-align: left;
  background: transparent;
  font-weight: 750;
}

.company-list button:hover {
  background: var(--paper);
}

.section-list {
  display: grid;
  gap: 12px;
}

.section-card {
  position: relative;
  width: 100%;
  min-height: 80px;
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  align-items: center;
  border: 3px solid var(--olive-dark);
  border-radius: 10px;
  overflow: hidden;
  background: var(--olive);
  color: #fff;
  text-align: left;
}

.section-icon {
  height: 100%;
  min-height: 80px;
  display: grid;
  place-items: center;
  background: var(--swatch, rgba(255, 255, 255, 0.16));
}

.section-icon img {
  width: 96%;
  height: 76px;
  object-fit: contain;
}

.section-icon .emoji-icon {
  font-size: 54px;
  line-height: 1;
}

.section-title {
  min-width: 0;
  padding: 0 64px 0 18px;
  font-size: clamp(30px, 8vw, 52px);
  line-height: 1.02;
  font-weight: 660;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.section-card.has-counters .section-title {
  padding-right: 58px;
}

.section-card.small-title .section-title {
  font-size: clamp(24px, 6.4vw, 42px);
}

.counter-row {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 3px;
  z-index: 2;
  pointer-events: none;
}

.counter {
  min-width: 22px;
  height: 18px;
  border-radius: 6px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  text-align: center;
  color: #fff;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
}

.counter.green {
  background: #288a46;
}

.counter.yellow {
  background: #d6a500;
  color: var(--ink);
}

.counter.red {
  background: #d13434;
}

.message {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.4;
  font-weight: 700;
}

.message.compact {
  margin: 8px 0;
}

.error {
  color: #a21919;
  background: rgba(214, 64, 64, 0.1);
  border: 1px solid rgba(214, 64, 64, 0.35);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 750;
}

.section-screen {
  min-height: calc(100vh - 38px);
  background: var(--section-bg, var(--paper));
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.section-header h2 {
  margin: 0;
  font-size: clamp(28px, 8vw, 46px);
  line-height: 1;
}

.section-header-tile {
  width: 84px;
  height: 84px;
  display: grid;
  place-items: center;
  border: 3px solid rgba(0, 0, 0, 0.24);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.32);
}

.section-header-tile.active-tile {
  cursor: pointer;
}

.section-header-tile.active-tile:hover {
  background: rgba(255, 255, 255, 0.5);
}

.section-header-tile img {
  width: 96%;
  height: 76px;
  object-fit: contain;
}

.staff-list {
  display: grid;
  gap: 6px;
}

.staff-card {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  border: 2px solid rgba(24, 33, 22, 0.4);
  border-radius: 6px;
  padding: 1px 10px;
  color: #fff;
  font-size: 20px;
  line-height: 1.05;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.staff-card:disabled {
  cursor: default;
  opacity: 1;
}

.staff-card.offline::before {
  content: "";
  align-self: stretch;
  width: 14px;
  margin: -1px 8px -1px -10px;
  background: #1fa64a;
  border-radius: 4px 0 0 4px;
}

.staff-card.light {
  color: var(--ink);
}

.section-card-wrap {
  position: relative;
}

.card-actions {
  position: absolute;
  right: 8px;
  top: 50%;
  z-index: 3;
  display: flex;
  gap: 6px;
  transform: translateY(-50%);
}

.card-actions button {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.55);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  font-weight: 800;
}

.section-floating-menu {
  position: fixed;
  z-index: 40;
  right: 26px;
  top: 108px;
  width: min(260px, calc(100vw - 36px));
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.section-floating-menu button {
  border: 0;
  border-radius: 8px;
  padding: 11px 12px;
  background: var(--paper);
  color: var(--ink);
  text-align: left;
  font-weight: 750;
}

.compact-title-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.compact-title-row h1 {
  margin: 0;
  font-size: clamp(24px, 4vw, 40px);
  line-height: 1.05;
  text-align: center;
}

.timesheet-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 8px;
}

.timesheet-tools.compact {
  margin: 4px 0 6px;
}

.sort-button.active {
  background: var(--olive);
  color: #fff;
}

.date-pill {
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 850;
}

.timesheet-wrap {
  overflow: auto;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.5);
}

.timesheet {
  width: 100%;
  min-width: 660px;
  border-collapse: separate;
  border-spacing: 3px;
  font-size: 14px;
  font-weight: 700;
}

.web-timesheet {
  min-width: 920px;
  border-spacing: 2px;
  font-size: 13px;
}

.timesheet th {
  background: var(--olive-dark);
  color: #fff;
  border-radius: 5px;
  padding: 7px 6px;
  white-space: nowrap;
}

.web-timesheet th {
  padding: 5px 5px;
}

.timesheet td {
  min-width: 42px;
  border: 1px solid #cbd6c3;
  border-radius: 5px;
  padding: 6px;
  text-align: center;
  background: #fbfdf8;
}

.web-timesheet td {
  min-width: 36px;
  padding: 4px 5px;
}

.timesheet .name-cell {
  min-width: 170px;
  text-align: left;
  font-weight: 850;
}

.web-timesheet .name-cell {
  min-width: 190px;
  max-width: 260px;
}

.web-timesheet .sum-cell {
  min-width: 54px;
  font-weight: 850;
}

.staff-name-cell {
  position: relative;
  color: #fff;
  overflow: hidden;
}

.staff-name-cell.light {
  color: var(--ink);
}

.staff-name-cell .offline-strip {
  position: absolute;
  inset: 0 auto 0 0;
  width: 14px;
  background: #1fa64a;
}

.staff-name-cell .offline-strip + .staff-name-text {
  margin-left: 14px;
}

.timesheet .today {
  outline: 3px solid #d6a500;
}

.timesheet .weekend {
  color: #d13434;
}

.timesheet .night {
  background: #dff1d8;
}

.timesheet .open {
  background: #ffeaa5;
}

.timesheet .rating-1 {
  background: #f3d7d7;
}

.timesheet .rating-2 {
  background: #ffd18a;
}

.timesheet .rating-3 {
  background: #fbfdf8;
}

.timesheet .rating-4 {
  background: #bfe7ff;
}

.timesheet .rating-5 {
  background: #2b6ea8;
  color: #fff;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(38px, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.calendar-day {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.65);
}

.calendar-day strong {
  display: block;
}

.calendar-day.today {
  border-color: #d6a500;
  box-shadow: inset 0 0 0 2px #d6a500;
}

.calendar-hours {
  margin-top: 3px;
  color: var(--olive-dark);
  font-weight: 850;
}

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.42);
}

.web-dialog {
  width: min(100%, 560px);
  max-height: calc(100vh - 36px);
  overflow: auto;
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: #f7fbf4;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.dialog-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dialog-title h2 {
  margin: 0;
  font-size: clamp(22px, 4vw, 30px);
}

.quick-form {
  display: grid;
  gap: 10px;
}

.staff-access-dialog {
  width: min(100%, 740px);
}

.owner-lock-card {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 2px solid rgba(73, 106, 50, 0.36);
  border-radius: 10px;
  background: rgba(73, 106, 50, 0.12);
}

.owner-lock-card.is-open {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(34, 142, 85, 0.55);
}

.owner-lock-card p {
  margin: 0;
  color: rgba(26, 38, 28, 0.78);
  font-weight: 750;
}

.owner-lock-form {
  display: grid;
  gap: 9px;
}

.owner-lock-trigger {
  width: 100%;
  min-height: 48px;
  font-size: 18px;
}
.owner-lock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.access-manager-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 2px solid rgba(73, 106, 50, 0.28);
  border-radius: 10px;
  background: rgba(73, 106, 50, 0.1);
}

.access-manager-card.is-on {
  border-color: rgba(209, 52, 52, 0.52);
  background: rgba(209, 52, 52, 0.09);
}

.access-manager-card p {
  margin: 0;
  color: rgba(26, 38, 28, 0.78);
  font-weight: 750;
}

.danger-text {
  color: #c62828 !important;
}

.danger-button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  background: #d63f3f;
  color: #fff;
  font-weight: 850;
  cursor: pointer;
}

.danger-button:disabled {
  opacity: 0.55;
  cursor: default;
}

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

.permission-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 2px solid rgba(73, 106, 50, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

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

.permission-check {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
}

.permission-check.is-on {
  box-shadow: inset 0 0 0 1px currentColor;
}

.permission-check.view {
  border-color: #36a868;
}

.permission-check.edit {
  border-color: #e0b22f;
}

.permission-check input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--olive-dark);
}

.permission-check span {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.permission-check b {
  font-size: 13px;
  line-height: 1.05;
}

.permission-check small {
  font-size: 10px;
  line-height: 1.05;
  color: rgba(26, 38, 28, 0.66);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.permission-check.is-on small {
  color: #c62828;
}

.field textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

@media (min-width: 860px) {
  .app-shell {
    align-items: stretch;
    padding: 12px 18px;
  }

  .phone-surface {
    width: min(100%, 1760px);
    min-height: calc(100vh - 24px);
  }

  .screen {
    min-height: calc(100vh - 26px);
    padding: 16px 20px;
  }

  .home-screen {
    display: flex;
    flex-direction: column;
  }

  .top-line {
    margin-bottom: 10px;
  }

  .brand {
    font-size: 28px;
  }

  .home-desktop-grid {
    display: grid;
    grid-template-columns: minmax(280px, 330px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
  }

  .home-header {
    grid-template-columns: 1fr 118px;
    gap: 10px;
    margin-bottom: 8px;
  }

  .logo-box {
    min-height: 106px;
  }

  .logo-box img {
    max-height: 106px;
  }

  .enterprise-box {
    min-height: 118px;
    font-size: 14px;
  }

  .enterprise-box img {
    max-height: 78px;
  }

  .company-name {
    margin: 0;
    font-size: clamp(20px, 2.2vw, 30px);
  }

  .home-sections {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .section-card {
    min-height: 64px;
    grid-template-columns: 86px minmax(0, 1fr);
    border-width: 2px;
  }

  .section-icon {
    min-height: 64px;
  }

  .section-icon img {
    height: 60px;
  }

  .section-icon .emoji-icon {
    font-size: 42px;
  }

  .section-title,
  .section-card.small-title .section-title {
    padding: 0 54px 0 12px;
    font-size: clamp(24px, 2.8vw, 36px);
  }

  .section-card.has-counters .section-title {
    padding-right: 44px;
  }

  .section-screen {
    display: flex;
    flex-direction: column;
  }

  .section-header {
    margin-bottom: 12px;
  }

  .section-header h2 {
    font-size: clamp(28px, 3vw, 38px);
  }

  .section-header-tile {
    width: 68px;
    height: 68px;
    border-width: 2px;
  }

  .section-header-tile img {
    height: 62px;
  }

  .module-screen .section-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .staff-screen .staff-list {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 5px 8px;
  }

  .staff-card {
    min-height: 28px;
    font-size: 18px;
    padding: 1px 8px;
  }

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

  .timesheet-tools {
    margin: 6px 0;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(96px, 1fr));
    gap: 5px;
  }

  .calendar-day {
    min-height: 66px;
  }
}

@media (min-width: 1180px) {
  .staff-screen .staff-list {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }

  .module-screen .section-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .calendar-grid {
    grid-template-columns: repeat(7, minmax(120px, 1fr));
  }
}

@media (min-width: 1240px) {
  .home-desktop-grid {
    grid-template-columns: 340px minmax(0, 1fr);
  }

  .home-sections {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .section-title,
  .section-card.small-title .section-title {
    font-size: clamp(22px, 2vw, 32px);
  }

  .section-card.has-counters .section-title {
    padding-right: 44px;
  }
}

@media (min-width: 860px) and (max-height: 760px) {
  .app-shell {
    padding: 8px 12px;
  }

  .phone-surface {
    min-height: calc(100vh - 16px);
    border-radius: 12px;
  }

  .screen {
    min-height: calc(100vh - 18px);
    padding: 10px 14px;
  }

  .top-line {
    margin-bottom: 6px;
  }

  .home-desktop-grid {
    gap: 12px;
  }

  .home-header {
    grid-template-columns: 1fr 94px;
  }

  .logo-box {
    min-height: 82px;
  }

  .logo-box img {
    max-height: 82px;
  }

  .enterprise-box {
    min-height: 92px;
    font-size: 12px;
  }

  .enterprise-box img {
    max-height: 58px;
  }

  .section-card {
    min-height: 52px;
    grid-template-columns: 68px minmax(0, 1fr);
    border-width: 2px;
  }

  .section-icon {
    min-height: 52px;
  }

  .section-icon img {
    height: 50px;
  }

  .section-icon .emoji-icon {
    font-size: 34px;
  }

  .section-title,
  .section-card.small-title .section-title {
    padding: 0 48px 0 12px;
    font-size: clamp(20px, 2.1vw, 28px);
  }

  .section-card.has-counters .section-title {
    padding-right: 42px;
  }

  .section-header-tile {
    width: 58px;
    height: 58px;
  }

  .section-header-tile img {
    height: 52px;
  }

  .calendar-day {
    min-height: 48px;
    padding: 4px;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 0;
  }

  .phone-surface,
  .wide-surface {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .screen {
    min-height: 100vh;
    padding: 18px 14px;
  }

  .home-header {
    grid-template-columns: 1fr 112px;
    gap: 10px;
  }

  .enterprise-box {
    min-height: 112px;
  }

  .logo-box {
    min-height: 104px;
  }

  .section-card {
    min-height: 52px;
    grid-template-columns: 68px minmax(0, 1fr);
    border-width: 2px;
  }

  .section-icon {
    min-height: 52px;
  }

  .section-icon img {
    height: 50px;
  }

  .section-icon .emoji-icon {
    font-size: 34px;
  }

  .section-title,
  .section-card.small-title .section-title {
    padding: 0 48px 0 12px;
    font-size: clamp(20px, 2.1vw, 28px);
  }

  .section-card.has-counters .section-title {
    padding-right: 42px;
  }

  .section-header-tile {
    width: 58px;
    height: 58px;
  }

  .section-header-tile img {
    height: 52px;
  }

  .calendar-day {
    min-height: 48px;
    padding: 4px;
  }
}
