﻿/* CRM — green and cream theme */

:root {
  --crm-ink: #173b2c;
  --crm-muted: #657263;
  --crm-primary: #20553e;
  --crm-primary-hover: #173f2d;
  --crm-line: #e2e7da;
  --crm-bg: #faf8f2;
  --crm-paper: #fffefb;
  --crm-sage: #edf2e5;
  --crm-shadow: 0 6px 24px rgba(23, 59, 44, .055);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--crm-bg);
  -webkit-text-size-adjust: 100%;
  scroll-padding-bottom: 110px;
}

body {
  margin: 0;
  background: var(--crm-bg);
  color: var(--crm-ink);
  font-family:
    "Plus Jakarta Sans", "Noto Sans Oriya",
    "Nirmala UI", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

button,
.button {
  display: inline-block;
  max-width: 100%;
  min-height: 48px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--crm-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, border-color .15s ease;
}

button:disabled,
.button[aria-disabled="true"] {
  opacity: .5;
  cursor: default;
}

.light,
button.light,
.button.light {
  background: var(--crm-sage);
  color: var(--crm-ink);
  border-color: #dce4d4;
}

.link,
button.link,
.button.link {
  background: transparent;
  color: var(--crm-primary);
  padding: 10px 12px;
}

.white,
button.white,
.button.white {
  background: var(--crm-paper);
  color: var(--crm-primary);
  border-color: #c8d5bf;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #799566;
  outline-offset: 3px;
}

input,
select,
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  margin-top: 8px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid #d7ded1;
  border-radius: 12px;
  background: var(--crm-paper);
  color: var(--crm-ink);
  font-size: 16px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #577959;
}

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

label {
  display: block;
  margin-top: 14px;
  color: var(--crm-ink);
  font-size: 13px;
  font-weight: 700;
}

form > button[type="submit"] {
  width: 100%;
  margin-top: 12px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.check input,
input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  height: 20px;
  min-height: 0;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--crm-primary);
}

input[type="file"] {
  font-size: 13px;
}

h1,
h2,
h3,
.brand,
.stat b {
  font-family:
    "Outfit", "Noto Sans Oriya", "Nirmala UI", sans-serif;
  color: var(--crm-ink);
  letter-spacing: -.025em;
}

h1 {
  margin: 5px 0;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
}

h2 {
  margin: 0 0 14px;
  font-size: 28px;
  font-weight: 600;
  line-height: 1.2;
}

h3 {
  margin: 0 0 14px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
}

p {
  margin: 8px 0;
  line-height: 1.65;
}

.muted,
small {
  color: var(--crm-muted);
}

.muted {
  font-size: 13px;
}

.brand {
  margin-bottom: 16px;
  color: var(--crm-primary);
  font-size: 30px;
  font-weight: 700;
}

.auth {
  max-width: 460px;
  margin: 8vh auto;
  padding: 20px;
}

.auth.wide {
  max-width: 620px;
}

.auth .card {
  padding: 30px;
  box-shadow: 0 16px 45px rgba(23, 59, 44, .075);
}

.card {
  min-width: 0;
  margin-bottom: 24px;
  padding: 26px;
  border: 1px solid var(--crm-line);
  border-radius: 24px;
  background: var(--crm-paper);
  box-shadow: var(--crm-shadow);
}

.shell {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 100vh;
}

.shell > aside {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  padding: 32px 18px;
  background: #153b2b;
  color: #fff;
}

.shell aside .brand {
  margin-inline: 10px;
  color: #faf7e9;
}

.shell aside .muted {
  color: #cbd8bf;
}

.shell > main {
  min-width: 0;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 30px 0;
}

aside nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #e0ead9;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
}

aside nav button.selected {
  background: #42664b;
  color: #fff;
}

aside > .link {
  color: #d5e3ca;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 36px;
  border-bottom: 1px solid var(--crm-line);
  background: var(--crm-paper);
}

header > * {
  min-width: 0;
}

header h1 {
  overflow-wrap: anywhere;
}

header small {
  color: #647a62;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .15em;
  text-transform: uppercase;
}

header > button,
header > .button {
  flex-shrink: 0;
}

.page {
  width: 100%;
  max-width: 1200px;
  margin: auto;
  padding: 32px 36px 48px;
}

/* Reminder slideshow and main dashboard CTA */
.hero {
  position: relative;
  min-width: 0;
  margin-bottom: 30px;
  padding: 40px;
  border: 1px solid #dce4d2;
  border-radius: 28px;
  background: #eef2e5;
  color: var(--crm-ink);
  box-shadow: var(--crm-shadow);
}

.hero h2 {
  max-width: 680px;
  margin: 14px 0 18px;
  font-size: clamp(32px, 3.8vw, 46px);
  line-height: 1.1;
}

.hero p {
  max-width: 560px;
  margin-bottom: 24px;
  color: #526453;
  font-size: 16px;
}

.eyebrow {
  color: #526e50;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.hero > button,
.hero > .button {
  min-height: 52px;
  padding: 14px 22px;
}

/* Existing dashboard stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 24px 0 32px;
}

.stat {
  min-width: 0;
  min-height: 140px;
  padding: 24px;
  border: 1px solid var(--crm-line);
  border-radius: 22px;
  background: var(--crm-paper);
  box-shadow: var(--crm-shadow);
}

.stat:nth-child(2) {
  background: #f0f3e9;
}

.stat:nth-child(3) {
  background: #fdf2e9;
}

.stat:nth-child(4) {
  background: #f7f9f1;
}

.stat b {
  display: block;
  margin-bottom: 12px;
  color: var(--crm-ink);
  font-size: 38px;
  font-weight: 600;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.stat span {
  color: #62705f;
  font-size: 13px;
  font-weight: 600;
}

/* Layout for reminders and upcoming items */
.two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 24px;
}

.quick {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.quick input[type="month"] {
  width: auto;
  max-width: 100%;
  margin: 0;
}

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

.title h2,
.title h3 {
  margin: 0;
}

.row,
.customer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 0;
  border-bottom: 1px solid #e9ede3;
}

.row:last-child,
.customer:last-child {
  border-bottom: 0;
}

.grow {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #e9efdf;
  color: var(--crm-primary);
  font-size: 20px;
  font-weight: 700;
}

.badge {
  padding: 7px 11px;
  border-radius: 12px;
  background: #eaf0e1;
  color: #355739;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.empty {
  padding: 24px;
  color: var(--crm-muted);
  text-align: center;
}

.history {
  margin: 20px 0;
  padding: 14px 16px;
  border-left: 3px solid #b9cba9;
}

details {
  margin: 18px 0;
}

summary {
  min-height: 44px;
  padding: 10px 0;
  color: var(--crm-primary);
  font-weight: 700;
  cursor: pointer;
}

.notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0;
  padding: 18px;
  border: 1px solid #ecd8c6;
  border-radius: 18px;
  background: #fcf0e5;
  color: #694d35;
}

.notice p {
  font-size: 14px;
}

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

.calendar > b {
  padding: 8px 0;
  color: var(--crm-muted);
  font-size: 12px;
  text-align: center;
}

.calendar > div {
  min-width: 0;
  min-height: 84px;
  padding: 8px;
  border: 1px solid var(--crm-line);
  border-radius: 12px;
  background: #f9faf5;
  font-size: 12px;
}

.calendar small {
  display: block;
  margin-top: 5px;
  color: var(--crm-primary);
  font-size: 10px;
  overflow-wrap: anywhere;
}

.calendar .today {
  border-color: #9bb187;
  background: #e7efda;
}

.preview {
  display: block;
  max-width: 100%;
  max-height: 320px;
  margin: 18px auto;
  border-radius: 18px;
  object-fit: contain;
}

.hidden {
  display: none !important;
}

dialog {
  width: min(580px, calc(100vw - 32px));
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  padding: 28px;
  border: 1px solid var(--crm-line);
  border-radius: 24px;
  background: var(--crm-paper);
  color: var(--crm-ink);
  box-shadow: 0 24px 90px rgba(16, 42, 32, .22);
}

dialog::backdrop {
  background: rgba(16, 42, 32, .45);
  backdrop-filter: blur(3px);
}

dialog .title {
  margin-bottom: 20px;
}

dialog h2 {
  font-size: 24px;
}

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 1000;
  max-width: calc(100vw - 32px);
  padding: 15px 22px;
  border-radius: 14px;
  background: #1b4531;
  color: #fff;
  box-shadow: var(--crm-shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%);
  transition: opacity .2s ease;
}

#toast.show {
  opacity: 1;
}

.welcome {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-height: 100vh;
  padding: 35px;
  background: #153b2b;
  color: #faf7e9;
  text-align: center;
}

.welcome img {
  width: 75vw;
  max-width: 340px;
  height: 340px;
  border: 5px solid rgba(255, 255, 255, .65);
  border-radius: 26px;
  object-fit: cover;
  box-shadow: 0 15px 65px rgba(0, 0, 0, .15);
}

.welcome h1 {
  margin-top: 26px;
  color: #faf7e9;
}

.welcome p {
  max-width: 430px;
  color: #dbe5ce;
  font-size: 18px;
}

.lotus {
  color: #cadbb4;
  font-size: 110px;
}

@media (hover: hover) {
  button:not(:disabled):hover,
  .button:hover {
    background: var(--crm-primary-hover);
    color: #fff;
  }

  button.light:not(:disabled):hover,
  .button.light:hover {
    background: #e0e8d7;
    color: var(--crm-ink);
  }

  button.link:not(:disabled):hover,
  .button.link:hover {
    background: #edf2e5;
    color: var(--crm-primary);
  }

  button.white:not(:disabled):hover,
  .button.white:hover {
    background: #f2f5eb;
    color: var(--crm-primary);
  }

  aside nav button:not(:disabled):hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
  }
}

/* Tablet */
@media (min-width: 851px) and (max-width: 1100px) {
  .shell {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .page {
    padding: 28px 24px 40px;
  }

  header {
    padding: 24px;
  }

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

  .two {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
}

/* Mobile: one row containing all six navigation items */
@media (max-width: 850px) {
  .shell {
    display: block;
  }

  .shell > aside {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    width: auto;
    height: auto;
    overflow: visible;
    padding: 8px 6px calc(8px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #dce3d4;
    border-radius: 20px 20px 0 0;
    background: var(--crm-paper);
    box-shadow: 0 -4px 20px rgba(23, 59, 44, .06);
  }

  .shell aside > .brand,
  .shell aside > .muted,
  .shell aside > .link {
    display: none;
  }

  aside nav {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 2px;
    margin: 0;
  }

  aside nav button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
    min-height: 64px;
    padding: 8px 3px;
    border-radius: 12px;
    background: transparent;
    color: #5f715e;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    overflow-wrap: normal;
  }

  aside nav button svg,
  aside nav button img {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
  }

  aside nav button.selected {
    background: #e7efdc;
    color: #1d4e35;
  }

  header {
    gap: 14px;
    padding: calc(22px + env(safe-area-inset-top, 0px)) 20px 22px;
  }

  header h1 {
    font-size: 27px;
  }

  header small {
    font-size: 9px;
  }

  header > button,
  header > .button {
    padding-inline: 14px;
  }

  .page {
    padding: 24px 18px calc(112px + env(safe-area-inset-bottom, 0px));
  }

  .hero {
    margin-bottom: 28px;
    padding: 28px 22px;
    border-radius: 26px;
  }

  .hero h2 {
    font-size: clamp(30px, 7.8vw, 40px);
  }

  .hero p {
    font-size: 15px;
  }

  .hero > button,
  .hero > .button {
    width: 100%;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin: 22px 0 30px;
  }

  .stat {
    min-height: 132px;
    padding: 20px;
    border-radius: 20px;
  }

  .stat b {
    font-size: 34px;
  }

  .stat span {
    font-size: 12px;
  }

  .two {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .card {
    margin-bottom: 22px;
    padding: 22px;
    border-radius: 22px;
  }

  h2 {
    font-size: 26px;
  }

  h3 {
    font-size: 20px;
  }

  .title {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px;
  }

  .row,
  .customer {
    flex-wrap: wrap;
    gap: 12px;
    padding: 18px 0;
  }

  .customer > .quick,
  .row > .quick {
    width: 100%;
    margin-left: 0;
  }

  .customer > .quick > button,
  .row > .quick > button {
    flex: 1 1 auto;
  }

  .quick input[type="month"] {
    width: 100%;
  }

  .notice {
    display: block;
  }

  .notice button {
    margin-top: 12px;
  }

  .calendar {
    gap: 4px;
  }

  .calendar > div {
    min-height: 72px;
    padding: 5px;
    border-radius: 8px;
  }

  .calendar small {
    font-size: 9px;
  }

  dialog {
    width: calc(100vw - 24px);
    max-height: 85dvh;
    padding: 22px;
  }

  #toast {
    bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  }

  .auth {
    margin: 30px auto;
  }

  .welcome img {
    height: 300px;
  }
}

@media (max-width: 380px) {
  .page {
    padding-inline: 14px;
  }

  .hero,
  .card {
    padding-inline: 18px;
  }

  .stats {
    gap: 10px;
  }

  .stat {
    padding: 17px;
  }

  .stat b {
    font-size: 30px;
  }

  aside nav button {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  button,
  .button,
  input,
  select,
  textarea,
  #toast {
    transition: none;
  }
}