* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  background: radial-gradient(circle at top, #f4f8f6 0%, #e4ece9 45%, #d7e2de 100%);
  color: #1f2d2f;
}

.layout-body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-wrapper {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  flex: 1;
}

a { color: #1f2d2f; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(6px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.9rem 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-logo {
  display: block;
  width: 150px;
  height: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.main-nav { display: flex; align-items: center; gap: 0.75rem; font-size: 0.9rem; }
.main-nav a { padding: 0.45rem 0.75rem; border-radius: 10px; font-weight: 500; }
.main-nav a:hover { background: rgba(31, 45, 47, 0.08); text-decoration: none; }
.main-nav .disabled-link { opacity: 0.45; pointer-events: none; }
.main-nav .nav-divider { color: rgba(31, 45, 47, 0.25); }
.main-nav .nav-user { font-weight: 600; color: #1f2d2f; padding: 0.45rem 0.75rem; background: rgba(31, 45, 47, 0.08); border-radius: 10px; }
.main-nav .logout-link { font-weight: 500; color: #be123c; }
.main-nav .logout-link:hover { background: rgba(190, 18, 60, 0.1); color: #881337; }

.site-footer {
  text-align: center;
  font-size: 0.75rem;
  color: #425657;
  padding: 2rem 1rem 2.5rem;
}

.page-title { margin: 0; font-size: 2.25rem; font-weight: 700; letter-spacing: 0.4px; }
.page-sub { margin: 0.5rem 0 0; color: #405255; font-size: 0.98rem; }
.section-title { margin: 0; font-size: 1.1rem; font-weight: 650; letter-spacing: 0.4px; }
.section-subtitle { margin: 0 0 0.9rem; font-size: 0.95rem; font-weight: 600; color: #314345; }
.helper-text { margin: 0; font-size: 0.78rem; color: #516566; }

.flash-container { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.5rem; }
.flash { padding: 0.85rem 1rem; border-radius: 14px; font-size: 0.85rem; font-weight: 600; }
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #34d399; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #f87171; }
.flash-info { background: #e0f2fe; color: #075985; border: 1px solid #38bdf8; }

.auth-wrapper { display: flex; justify-content: center; align-items: center; min-height: 60vh; }
.auth-card { max-width: 420px; width: 100%; }
.auth-header { display: flex; flex-direction: column; gap: 0.6rem; }
.auth-form { display: flex; flex-direction: column; gap: 1.1rem; }

.settings-wrapper { display: flex; justify-content: center; }
.settings-card { max-width: 560px; width: 100%; }
.settings-form { display: flex; flex-direction: column; gap: 1.1rem; }
.settings-divider { font-size: 0.82rem; font-weight: 650; color: #2f4546; border-top: 1px dashed #cdd9d6; padding-top: 0.85rem; margin-top: 0.3rem; }
.settings-password-grid { gap: 1rem; }
.settings-actions { display: flex; align-items: center; gap: 0.8rem; margin-top: 0.5rem; }
.settings-hint { margin-top: -0.4rem; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.danger-zone { margin-top: 2rem; padding: 1.4rem 1.5rem; border-radius: 20px; border: 1px solid #fca5a5; background: #fef2f2; display: flex; flex-direction: column; gap: 1rem; }
.danger-text { margin: 0; font-size: 0.82rem; font-weight: 600; color: #b91c1c; }
.danger-form { display: flex; flex-direction: column; gap: 1rem; }
.danger-actions { display: flex; align-items: center; gap: 0.75rem; }


.manager-header {
  background: rgba(255, 255, 255, 0.96);
  padding: 1.75rem 2rem;
  border-radius: 24px;
  box-shadow: 0 22px 50px -28px rgba(0, 0, 0, 0.55);
  margin-bottom: 2rem;
}

.manager-grid {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: 1.5rem;
  margin-bottom: 2rem;
  align-items: start;
}

.manager-grid.secondary { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 980px) {
  .manager-grid,
  .manager-grid.secondary {
    grid-template-columns: 1fr;
  }
}

.manager-card {
  background: rgba(255, 255, 255, 0.96);
  padding: 1.6rem 1.85rem;
  border-radius: 24px;
  box-shadow: 0 18px 44px -26px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.manager-column { display: flex; flex-direction: column; gap: 1.5rem; }

.user-entry-wrapper {
  background: #f5f9f7;
  padding: 1.2rem 1.35rem 1.4rem;
  border-radius: 18px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.user-entry-form {
  display: grid;
  align-items: end;
}
.form-actions { display: flex; align-items: center; gap: 0.75rem; grid-column: 1 / -1; margin-top: 0.4rem; }
.form-actions .secondary { background: #f1f5f9; color: #0f172a; border: 1px solid #d0dbe4; }

.user-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.85rem; }
.user-item { display: flex; flex-direction: column; gap: 0.4rem; }
.user-link { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1rem; background: #f3f6f4; border-radius: 18px; font-weight: 600; transition: 0.2s background, 0.2s color; }
.user-item.active .user-link { background: #1f2d2f; color: #ffffff; }
.user-link:hover { background: #e7efed; text-decoration: none; }
.user-item.active .user-link:hover { background: #243536; }
.user-info { display: flex; flex-direction: column; gap: 0.35rem; }
.user-name { font-size: 0.98rem; }
.user-meta { font-size: 0.78rem; opacity: 0.85; }
.user-last { font-size: 0.72rem; color: #506365; padding-left: 0.5rem; }
.user-chevron { font-size: 1.2rem; }

.empty-state { font-size: 0.85rem; color: #4f6365; padding: 0.4rem 0; }

.detail-header { display: flex; flex-direction: column; gap: 0.6rem; }
.detail-stats { display: flex; flex-wrap: wrap; gap: 1rem; font-size: 0.85rem; color: #355052; }
.detail-stats strong { font-size: 1.05rem; }

.week-summary { display: flex; flex-direction: column; gap: 1rem; }
.week-item { border: 1px solid #d9e3df; border-radius: 20px; background: #ffffff; overflow: hidden; transition: 0.25s box-shadow; }
.week-item[open] { box-shadow: 0 16px 48px -28px rgba(0, 0, 0, 0.45); }
.week-item summary { cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.05rem 1.2rem; font-weight: 600; }
.week-item summary::-webkit-details-marker { display: none; }
.week-meta { font-size: 0.8rem; font-weight: 500; color: #506365; }
.week-body { padding: 0 1.2rem 1.2rem; display: flex; flex-direction: column; gap: 1rem; }
.week-tags .tag { display: inline-block; padding: 0.35rem 0.7rem; border-radius: 999px; background: #eef4f3; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; color: #4b5f61; }

.table-scroll { overflow: auto; border-radius: 18px; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.25); }
.table-scroll.compact { border-radius: 16px; box-shadow: 0 8px 24px -16px rgba(0, 0, 0, 0.35); }
.table-scroll.tiny { border-radius: 14px; box-shadow: 0 6px 18px -14px rgba(0, 0, 0, 0.25); }

.harvest-table { width: 100%; border-collapse: collapse; min-width: 580px; }
.fields-card .harvest-table { min-width: 780px; }
.harvest-table th { background: #1f2d2f; color: #ffffff; text-align: left; font-weight: 600; padding: 0.75rem 0.9rem; font-size: 0.75rem; letter-spacing: 0.4px; }
.harvest-table td { padding: 0.65rem 0.9rem; background: #ffffff; font-size: 0.8rem; border-bottom: 1px solid #ecf2f3; }
.harvest-table tbody tr:hover td { background: #f4f8f6; }
.fields-card .harvest-table td:nth-child(3),
.fields-card .harvest-table td:nth-child(4) {
  text-align: center;
  white-space: nowrap;
  font-weight: 600;
}

.week-daily { display: flex; flex-direction: column; gap: 0.75rem; }
.week-daily-table { width: 100%; border-collapse: collapse; min-width: 0; }
.week-daily-table th { background: #ffffff; color: #2d3f41; text-align: left; font-weight: 600; padding: 0.55rem 0.7rem; font-size: 0.72rem; border-bottom: 1px solid #dbe4e1; }
.week-daily-table td { padding: 0.5rem 0.7rem; font-size: 0.75rem; border-bottom: 1px solid #eef2f1; background: #ffffff; }
.week-daily-table tr:last-child td { border-bottom: none; }

.field { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.8rem; font-weight: 500; letter-spacing: 0.35px; }
.field span { color: #3d5153; }
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #c7d5d2;
  background: #ffffff;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  font-size: 0.9rem;
  transition: 0.2s border, 0.2s box-shadow;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: #1f2d2f;
  box-shadow: 0 0 0 3px rgba(31, 45, 47, 0.18);
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #1f2d2f 50%), linear-gradient(135deg, #1f2d2f 50%, transparent 50%); background-position: calc(100% - 16px) calc(50% - 4px), calc(100% - 12px) calc(50% - 4px); background-size: 6px 6px; background-repeat: no-repeat; padding-right: 2.1rem; cursor: pointer; }
.field textarea { resize: vertical; min-height: 110px; }
.field.wide { grid-column: 1 / -1; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px) { .grid-3 { grid-template-columns: 1fr; } }
.gap-sm { gap: 0.75rem; }

.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); }
@media (max-width: 1100px) { .grid-5 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 768px) { .grid-5 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .grid-5 { grid-template-columns: 1fr; } }
.entry-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 1100px) { .entry-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 768px) { .entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .entry-grid { grid-template-columns: 1fr; } }

.btn {
  --btn-bg: #ffffff;
  --btn-color: #1f2d2f;
  border: 1px solid #c7d5d2;
  background: var(--btn-bg);
  color: var(--btn-color);
  padding: 0.7rem 1.1rem;
  font-weight: 600;
  border-radius: 12px;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: 0.25s background, 0.25s color, 0.25s border;
  text-decoration: none;
}

.btn:hover { background: #f0f5f3; }
.btn.primary { --btn-bg: #1f2d2f; --btn-color: #ffffff; border-color: #1f2d2f; }
.btn.primary:hover { background: #2b3e3f; }
.btn.secondary { --btn-bg: #f1f5f9; --btn-color: #0f172a; border-color: #d0dbe4; }
.btn.secondary:hover { background: #e5ecf3; }
.btn.ghost { --btn-bg: transparent; --btn-color: #1f2d2f; border-color: #c7d5d2; }
.btn.ghost:hover { background: #eef3f1; }
.btn.danger { --btn-bg: #b91c1c; --btn-color: #ffffff; border-color: #b91c1c; }
.btn.danger:hover { background: #991b1b; }
.btn.tiny { padding: 0.45rem 0.7rem; font-size: 0.72rem; border-radius: 8px; }

.manager-form button { align-self: end; justify-self: start; margin-top: 1.85rem; grid-column: 1 / -1; }


.actions-cell { text-align: right; white-space: nowrap; }
.actions-cell form { margin: 0; }

.bank-card { gap: 0.8rem; }
.bank-grid { display: grid; grid-template-columns: 1fr; gap: 0.65rem; font-size: 0.8rem; }
.bank-grid dt { font-weight: 600; color: #344647; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.4px; }
.bank-grid dd { margin: 0.15rem 0 0; font-weight: 600; font-size: 0.9rem; color: #1f2d2f; }

.future-placeholder { background: #f1f5f3; padding: 1.25rem 1.35rem; border-radius: 16px; display: flex; flex-direction: column; gap: 1rem; font-size: 0.85rem; color: #476061; }
.future-placeholder .btn { align-self: flex-start; opacity: 0.7; cursor: not-allowed; }

/* Session Timeout Warning */
.session-warning {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  animation: fadeIn 300ms ease;
}

.session-warning-content {
  background: #ffffff;
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.24);
  text-align: center;
  animation: slideUp 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.session-warning-content h3 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  color: #d93856;
  font-weight: 700;
}

.session-warning-content p {
  margin: 0 0 1.5rem 0;
  font-size: 0.95rem;
  color: #5a6b6e;
  line-height: 1.6;
}

.session-warning-actions {
  display: flex;
  gap: 1rem;
  flex-direction: column;
}

.session-warning-actions .btn {
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
}

.session-warning-actions .btn.primary {
  background: #d93856;
  color: white;
}

.session-warning-actions .btn.primary:hover {
  background: #c1274a;
  transform: translateY(-2px);
}

.session-warning-actions .btn.secondary {
  background: #f0f3f4;
  color: #394d4f;
  border: 1px solid #d0d8da;
}

.session-warning-actions .btn.secondary:hover {
  background: #e4eaec;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

