:root {
  color-scheme: light;
  --app-canvas: 946px;
  --app-zoom: 1;
  --nav-bottom: 0px;
  --nav-height: 78px;
  --ink: #16221b;
  --muted: #68736d;
  --line: #dfe4dc;
  --paper: #f4f6f1;
  --panel: #ffffff;
  --deep: #0d2a1c;
  --green: #1f6b45;
  --green-soft: #eaf4e8;
  --gold: #d6ad45;
  --blue: #315f8c;
  --red: #b94d3a;
  --shadow: 0 18px 48px rgba(22, 34, 27, 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(150deg, rgba(31, 107, 69, 0.12), transparent 34%),
    linear-gradient(330deg, rgba(214, 173, 69, 0.16), transparent 36%),
    var(--paper);
  color: var(--ink);
}

body.is-app-open {
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.phone-app {
  position: relative;
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  box-shadow: 0 0 0 1px rgba(22, 34, 27, 0.04), 0 28px 80px rgba(22, 34, 27, 0.14);
}

body.is-app-open .phone-app {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  box-shadow: none;
}

.login-view,
.app-view {
  min-height: 100vh;
}

.login-view {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 24px 18px;
}

.brand-card,
.login-card,
.hero-card,
.panel-card,
.metric-grid article,
.action-list article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(22, 34, 27, 0.06);
}

.brand-card {
  padding: 20px;
  background:
    linear-gradient(140deg, rgba(13, 42, 28, 0.96), rgba(19, 74, 47, 0.94)),
    var(--deep);
  color: #ffffff;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--gold);
  color: var(--deep);
  font-weight: 900;
}

.brand-card h1,
.login-card h2,
.app-header h1,
.hero-card h2 {
  margin-bottom: 0;
}

.brand-card h1 {
  font-size: 28px;
}

.company-lines {
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.76);
  line-height: 1.45;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-card .eyebrow {
  color: #f1d586;
}

.login-card {
  display: grid;
  gap: 16px;
  padding: 20px;
}

label {
  display: grid;
  gap: 8px;
  color: #3d4942;
  font-size: 13px;
  font-weight: 750;
}

input,
select {
  min-height: 48px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  padding: 0 14px;
}

input:focus,
select:focus {
  border-color: var(--green);
  outline: 3px solid rgba(31, 107, 69, 0.14);
}

.primary-action {
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  background: var(--deep);
  color: #ffffff;
  font-weight: 850;
}

.prototype-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.login-error {
  display: none;
  margin: -4px 0 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.35;
}

.login-error.is-visible {
  display: block;
}

.is-hidden {
  display: none !important;
}

.app-view {
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding-bottom: calc(var(--nav-height) + var(--nav-bottom) + env(safe-area-inset-bottom) + 18px);
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(16px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(244, 246, 241, 0.94);
  border-bottom: 1px solid rgba(223, 228, 220, 0.86);
  backdrop-filter: blur(14px);
}

body.is-app-open .app-header,
body.is-app-open .screen-stack {
  width: var(--app-canvas);
  max-width: none;
  zoom: var(--app-zoom);
}

.app-header h1 {
  font-size: 27px;
}

.profile-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--deep);
  font-weight: 900;
}

.screen-stack {
  min-width: 0;
  padding: 12px 14px 18px;
}

.screen {
  display: none;
  gap: 14px;
}

.screen.is-active {
  display: grid;
}

.hero-card {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  min-height: 152px;
  padding: 18px;
  color: #ffffff;
  overflow: hidden;
}

.hero-card h2 {
  font-size: 27px;
  line-height: 1.08;
}

.hero-card span,
.hero-card strong {
  color: rgba(255, 255, 255, 0.88);
}

.business-hero {
  background: linear-gradient(140deg, #0d2a1c, #1f6b45);
}

.inventory-hero {
  background: linear-gradient(140deg, #194632, #7b8f33);
}

.cashflow-hero {
  background: linear-gradient(140deg, #0d2a1c, #9a6a21);
}

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

.metric-grid article {
  min-height: 112px;
  padding: 14px;
}

.metric-grid span,
.metric-grid small {
  display: block;
  color: var(--muted);
}

.metric-grid strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 25px;
}

.panel-card {
  padding: 16px;
}

.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h3 {
  margin-bottom: 0;
  font-size: 20px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.timeline-list,
.action-list {
  display: grid;
  gap: 10px;
}

.timeline-list div,
.action-list article {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.timeline-list span,
.action-list span {
  color: var(--muted);
  line-height: 1.4;
}

.tab-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.tab-strip::-webkit-scrollbar {
  display: none;
}

.tab-strip button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  padding: 0 12px;
  white-space: nowrap;
}

.tab-strip button.is-active {
  background: var(--deep);
  color: #ffffff;
  border-color: var(--deep);
}

.compact-action,
.secondary-action {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  padding: 0 12px;
  font-weight: 800;
}

.month-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 118px;
  gap: 10px;
  margin: -4px 0 14px;
}

.month-controls label {
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.month-controls select {
  min-height: 42px;
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--green) 50%),
    linear-gradient(135deg, var(--green) 50%, transparent 50%),
    #fbfcfa;
  background-position:
    calc(100% - 17px) 18px,
    calc(100% - 12px) 18px,
    0 0;
  background-size:
    5px 5px,
    5px 5px,
    100% 100%;
  background-repeat: no-repeat;
  color: var(--ink);
  font-weight: 850;
}

.secondary-action {
  min-height: 44px;
  width: 100%;
  background: var(--panel);
}

.calendar-weekdays,
.month-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-weekdays {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-align: center;
  text-transform: uppercase;
}

.month-calendar button,
.month-empty {
  aspect-ratio: 1;
  min-width: 0;
}

.month-calendar button {
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fbfcfa;
  border: 1px solid var(--line);
  color: var(--ink);
  font-weight: 850;
}

.month-calendar button.is-today {
  border-color: var(--gold);
}

.month-calendar button.is-selected {
  background: var(--deep);
  border-color: var(--deep);
  color: #ffffff;
}

.week-timeline {
  margin: 0 -16px -16px;
  overflow-x: visible;
  padding: 0 16px 16px;
  scrollbar-width: thin;
}

.week-grid {
  display: grid;
  grid-template-columns: 52px repeat(7, minmax(0, 1fr));
  gap: 5px;
  min-width: 0;
}

.week-corner,
.week-day,
.hour-label,
.hour-cell {
  min-height: 40px;
  border-radius: 8px;
}

.week-corner,
.hour-label {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.week-day {
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 7px 4px;
  border: 1px solid var(--line);
  background: #fbfcfa;
}

.week-day strong,
.week-day span {
  display: block;
  font-size: 11px;
  line-height: 1;
}

.week-day span {
  color: var(--muted);
}

.week-day.is-selected {
  border-color: var(--deep);
  background: var(--deep);
  color: #ffffff;
}

.week-day.is-selected span {
  color: rgba(255, 255, 255, 0.75);
}

.week-day.is-today:not(.is-selected) {
  border-color: var(--gold);
}

.hour-cell {
  border: 1px solid var(--line);
  background: #f1f7ef;
  color: var(--green);
  font-size: 11px;
  font-weight: 850;
}

.hour-cell.sila {
  background: #e9f1f8;
  color: var(--blue);
}

.hour-cell.empty {
  background: #fbfcfa;
  color: var(--muted);
  font-weight: 750;
}

.hour-cell.is-selected-day {
  box-shadow: inset 0 0 0 2px rgba(13, 42, 28, 0.16);
}

.hour-cell.is-current-shift {
  position: relative;
  border-color: var(--gold);
  background: #fff5d7;
  color: #5c4311;
  box-shadow: inset 0 0 0 2px rgba(214, 173, 69, 0.38), 0 0 0 2px rgba(214, 173, 69, 0.16);
}

.hour-cell.is-current-shift::after {
  content: "En cours";
  display: block;
  margin-top: 2px;
  color: #7a5a16;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(13, 42, 28, 0.34);
}

.shift-modal {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2 {
  margin: 0;
  font-size: 23px;
}

.modal-header button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

.modal-meta {
  margin: 6px 0 14px;
  color: var(--muted);
  font-weight: 750;
}

.employee-picker {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.employee-picker button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 900;
}

.employee-picker .malieta {
  background: var(--green-soft);
  color: var(--green);
}

.employee-picker .sila {
  background: #e9f1f8;
  color: var(--blue);
}

.employee-picker .empty {
  background: #fbfcfa;
  color: var(--muted);
}

.bottom-nav {
  position: fixed;
  right: 50%;
  bottom: calc(var(--nav-bottom) + env(safe-area-inset-bottom));
  z-index: 100;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(100%, 460px);
  transform: translateX(50%);
  min-height: var(--nav-height);
  padding: 8px;
  border-top: 1px solid rgba(223, 228, 220, 0.9);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

body.is-app-open .bottom-nav {
  left: 0;
  right: auto;
  width: 100%;
  max-width: none;
  transform: none;
  min-height: 48px;
  padding: 4px 6px;
}

body.is-app-open .bottom-nav button {
  min-height: 40px;
  font-size: 9px;
}

body.is-app-open .bottom-nav svg {
  width: 16px;
  height: 16px;
}

.bottom-nav button {
  display: grid;
  place-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 62px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.bottom-nav button.is-active {
  background: var(--green-soft);
  color: var(--green);
}

.bottom-nav svg {
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 380px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .week-grid {
    grid-template-columns: 44px repeat(7, minmax(0, 1fr));
    gap: 4px;
  }

  .bottom-nav button span {
    font-size: 10px;
  }
}

@media (min-width: 700px) {
  body {
    padding: 24px 0;
  }

  body.is-app-open {
    padding: 0;
  }

  .phone-app {
    min-height: calc(100vh - 48px);
    border-radius: 28px;
    overflow: hidden;
  }

  body.is-app-open .phone-app {
    min-height: 100vh;
    border-radius: 0;
  }

  .login-view,
  .app-view {
    min-height: calc(100vh - 48px);
  }

  body.is-app-open .app-view {
    min-height: 100vh;
  }

  .bottom-nav {
    bottom: 24px;
    border-radius: 0 0 28px 28px;
  }

  body.is-app-open .bottom-nav {
    bottom: calc(var(--nav-bottom) + env(safe-area-inset-bottom));
    border-radius: 0;
  }
}
