:root {
  --green: #4c9c2e;
  --green-dark: #2f6f24;
  --green-soft: #edf6e9;
  --lime: #7dbe3c;
  --ink: #252a25;
  --muted: #6e756e;
  --line: #e3e8e1;
  --paper: #ffffff;
  --canvas: #f6f8f5;
  --danger: #b93636;
  --warning: #aa7212;
  --shadow: 0 16px 46px rgba(35, 60, 30, .11);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--canvas); }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { color: var(--green-dark); font-size: .73rem; font-weight: 800; letter-spacing: .16em; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1.05fr) minmax(440px, .95fr); }
.auth-brand { position: relative; display: grid; place-items: center; padding: 55px; overflow: hidden; background: linear-gradient(145deg, #163d1d 0%, #2f6f24 55%, #559c32 100%); color: white; }
.auth-brand::before, .auth-brand::after { content: ""; position: absolute; border-radius: 50%; border: 1px solid rgba(255,255,255,.13); }
.auth-brand::before { width: 540px; height: 540px; left: -170px; bottom: -240px; }
.auth-brand::after { width: 360px; height: 360px; right: -140px; top: -130px; }
.auth-brand__content { width: min(480px, 100%); position: relative; z-index: 1; }
.auth-logo { width: 270px; max-width: 80%; background: white; border-radius: 18px; padding: 13px 22px; box-shadow: var(--shadow); }
.auth-brand__content > p { font-size: 1.16rem; line-height: 1.6; margin: 30px 0 42px; color: rgba(255,255,255,.82); }
.auth-feature { display: flex; gap: 17px; align-items: center; margin-top: 24px; }
.auth-feature > span { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; font-size: .75rem; }
.auth-feature strong, .auth-feature small { display: block; }
.auth-feature small { margin-top: 4px; color: rgba(255,255,255,.68); }
.auth-panel { display: grid; place-items: center; padding: 45px; background: var(--paper); }
.auth-card { width: min(420px, 100%); }
.auth-card h1 { font-size: 2.2rem; margin: 12px 0 7px; letter-spacing: -.04em; }
.auth-card > .muted { margin: 0 0 34px; }

label { display: grid; gap: 8px; margin-bottom: 18px; font-size: .86rem; font-weight: 700; color: #454a45; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 12px 13px; color: var(--ink); background: white; outline: none; transition: border .2s, box-shadow .2s; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(76,156,46,.12); }
textarea { resize: vertical; min-height: 94px; }
.button { border: 0; border-radius: 11px; padding: 11px 17px; font-weight: 750; transition: transform .15s, background .15s; }
.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--green-dark); box-shadow: 0 8px 18px rgba(47,111,36,.19); }
.button.primary:hover { background: #255b1c; }
.button.secondary { background: var(--green-soft); color: var(--green-dark); }
.button.ghost { color: var(--ink); background: white; border: 1px solid var(--line); }
.button.danger { color: var(--danger); background: #fceeee; }
.button.wide { width: 100%; padding: 13px 18px; }
.button.small { padding: 8px 12px; font-size: .81rem; }
.text-button { border: 0; padding: 0; background: none; color: var(--muted); }

.app-layout { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 242px; background: #fff; border-right: 1px solid var(--line); padding: 24px 18px; display: flex; flex-direction: column; z-index: 20; }
.sidebar-brand { height: 92px; display: grid; place-items: center; margin-bottom: 20px; }
.sidebar-brand img { width: 180px; max-height: 90px; object-fit: contain; }
.sidebar nav { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 13px; width: 100%; border: 0; border-radius: 11px; padding: 12px 14px; background: transparent; color: #626862; text-align: left; font-weight: 650; }
.nav-item span { width: 22px; text-align: center; font-size: 1.15rem; }
.nav-item:hover { color: var(--green-dark); background: var(--green-soft); }
.nav-item.active { color: white; background: var(--green-dark); box-shadow: 0 8px 18px rgba(47,111,36,.17); }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--line); padding-top: 18px; }
.user-mini { display: flex; gap: 10px; align-items: center; margin-bottom: 13px; min-width: 0; }
.user-mini > span { flex: 0 0 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: white; background: var(--green); font-size: .78rem; font-weight: 800; }
.user-mini div { min-width: 0; }
.user-mini strong, .user-mini small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-mini strong { font-size: .85rem; }
.user-mini small { color: var(--muted); font-size: .72rem; margin-top: 2px; }
.mobile-header { display: none; }
.page { margin-left: 242px; min-height: 100vh; padding: 40px clamp(28px, 4vw, 64px); }
.page-header { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 29px; }
.page-header h1 { font-size: clamp(1.75rem, 2.6vw, 2.45rem); letter-spacing: -.045em; margin: 0 0 7px; }
.page-header p { margin: 0; color: var(--muted); }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 17px; }
.summary-card { min-height: 145px; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; background: white; position: relative; overflow: hidden; box-shadow: 0 5px 24px rgba(41,67,36,.045); }
.summary-card::after { content: ""; position: absolute; width: 75px; height: 75px; border-radius: 50%; background: var(--green-soft); right: -22px; bottom: -24px; }
.summary-card small { color: var(--muted); font-weight: 650; }
.summary-card strong { display: block; font-size: 2rem; margin-top: 22px; letter-spacing: -.04em; }
.section-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); margin-top: 20px; overflow: hidden; box-shadow: 0 5px 24px rgba(41,67,36,.04); }
.section-title { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.section-title h2 { font-size: 1rem; margin: 0; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: .82rem; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar input, .toolbar select { width: auto; min-width: 170px; margin: 0; }
.search { flex: 1; min-width: 220px !important; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 15px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); background: #fbfcfb; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
td { font-size: .88rem; }
tr:last-child td { border-bottom: 0; }
.cell-main { font-weight: 750; }
.cell-sub { display: block; color: var(--muted); font-size: .76rem; margin-top: 4px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 9px; font-size: .71rem; font-weight: 800; }
.badge.green { background: #eaf6e5; color: #367923; }
.badge.gray { background: #eff1ef; color: #626762; }
.badge.yellow { background: #fff4d9; color: #926110; }
.badge.red { background: #fce8e8; color: #a33232; }
.badge.blue { background: #e9f2f6; color: #37687d; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 7px; }

.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 17px; }
.project-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 5px 24px rgba(41,67,36,.04); }
.project-card__top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.project-card h3 { margin: 13px 0 5px; font-size: 1.05rem; }
.project-card p { margin: 0; color: var(--muted); font-size: .84rem; }
.project-card__meta { display: grid; gap: 8px; border-top: 1px solid var(--line); margin-top: 18px; padding-top: 15px; font-size: .8rem; color: var(--muted); }
.activity-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.activity-row:last-child { border-bottom: 0; }
.date-block { border-radius: 11px; background: var(--green-soft); color: var(--green-dark); padding: 8px 5px; text-align: center; }
.date-block strong, .date-block small { display: block; }
.date-block strong { font-size: 1.05rem; }
.date-block small { font-size: .64rem; text-transform: uppercase; }
.activity-row h3 { margin: 0 0 5px; font-size: .92rem; }
.activity-row p { margin: 0; color: var(--muted); font-size: .78rem; }

.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20,30,20,.6); backdrop-filter: blur(3px); }
.modal-card { position: relative; z-index: 1; width: min(680px, 100%); max-height: calc(100vh - 44px); overflow-y: auto; background: white; border-radius: 20px; padding: 28px; box-shadow: var(--shadow); }
.modal-card.wide { width: min(950px, 100%); }
.modal-close { position: absolute; right: 18px; top: 16px; border: 0; background: transparent; font-size: 1.7rem; color: var(--muted); }
.modal h2 { margin: 0 45px 8px 0; letter-spacing: -.025em; }
.modal-description { color: var(--muted); margin: 0 0 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 15px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 9px; }
.photo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.drop-zone { border: 1px dashed #a8b5a3; padding: 18px; border-radius: 13px; background: #fbfdfb; }
.toast { position: fixed; right: 25px; bottom: 25px; z-index: 200; padding: 13px 17px; color: white; background: #243124; border-radius: 11px; box-shadow: var(--shadow); max-width: 370px; }
.toast.error { background: #8f2f2f; }
.loading { min-height: 300px; display: grid; place-items: center; color: var(--muted); }

@media (max-width: 1050px) {
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .auth-panel { min-height: 100vh; padding: 30px 23px; }
  .sidebar { transform: translateX(-102%); transition: transform .22s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .mobile-header { height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 8px 17px; background: white; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 15; }
  .mobile-header img { height: 48px; max-width: 150px; object-fit: contain; }
  .mobile-header button { border: 0; background: transparent; font-size: 1.45rem; }
  .page { margin-left: 0; padding: 25px 17px 45px; }
  .page-header { align-items: stretch; flex-direction: column; }
  .summary-grid, .card-grid, .form-grid, .photo-pair { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .activity-row { grid-template-columns: 50px minmax(0,1fr); }
  .activity-row > :last-child { grid-column: 2; justify-self: start; }
  .modal { padding: 10px; }
  .modal-card { padding: 24px 18px; max-height: calc(100vh - 20px); }
}
