@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root { --ink: #17212b; --muted: #71808c; --paper: #fffdf8; --line: #e7e1d7; --navy: #153243; --teal: #1b8a82; --coral: #e87561; --gold: #e8b64a; --shadow: 0 24px 70px rgba(21, 50, 67, .14); }
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { min-height: 100vh; color: var(--ink); font-family: 'DM Sans', 'Trebuchet MS', sans-serif; background: #f5f0e8; }
body::before { content: ''; position: fixed; inset: 0; z-index: -1; background: radial-gradient(circle at 8% 10%, rgba(232,182,74,.22), transparent 28%), radial-gradient(circle at 94% 86%, rgba(27,138,130,.18), transparent 30%); }
button, input, select, textarea { font: inherit; }
button { position: relative; overflow: hidden; border: 0; border-radius: 10px; color: #fff; font-weight: 700; cursor: pointer; transition: transform .2s cubic-bezier(.2,.8,.2,1), box-shadow .2s ease, opacity .2s ease, filter .2s ease; }
button::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 25%, rgba(255,255,255,.24) 48%, transparent 70%); transform: translateX(-125%); transition: transform .55s ease; pointer-events: none; }
button:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(21,50,67,.18); filter: saturate(1.08); }
button:hover::after { transform: translateX(125%); }
button:active { transform: translateY(0) scale(.97); box-shadow: 0 4px 10px rgba(21,50,67,.14); }
button:focus-visible { outline: 3px solid rgba(232,182,74,.8); outline-offset: 3px; }
button:disabled { cursor: wait; opacity: .65; transform: none; filter: grayscale(.15); }
button:disabled::after { animation: loading-shine 1.2s linear infinite; }
.app-shell { min-height: 100vh; display: flex; justify-content: center; align-items: center; padding: 32px; }
.auth-card, .dashboard { width: min(1180px, 100%); background: rgba(255,253,248,.9); border: 1px solid rgba(255,255,255,.8); box-shadow: var(--shadow); }
.auth-card { max-width: 470px; padding: 42px 38px; border-radius: 24px; animation: rise .6s ease both; }
.brand { display: flex; align-items: center; gap: 13px; margin-bottom: 26px; }
.brand-logo { justify-content: center; margin-bottom: 18px; }
.brand-logo-image { display: block; width: min(100%, 360px); height: auto; filter: drop-shadow(0 10px 20px rgba(21, 50, 67, .12)); }
.brand-mark { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; color: #fff; font: 700 1.6rem 'Space Grotesk', sans-serif; background: var(--navy); box-shadow: 8px 8px 0 var(--coral); }
.brand h1 { margin: 0; color: var(--navy); font: 700 clamp(1.65rem, 4vw, 2.2rem) 'Space Grotesk', sans-serif; }
.auth-card > p { margin: 0 0 30px; color: var(--muted); }
.form-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 17px; }
label { color: var(--navy); font-size: .88rem; font-weight: 700; }
input, select, textarea { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; outline: none; color: var(--ink); background: #fff; transition: border-color .2s, box-shadow .2s; }
textarea { resize: vertical; min-height: 82px; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 4px rgba(27,138,130,.12); }
button.primary { width: 100%; padding: 14px 16px; margin-top: 6px; background: var(--navy); }
button.secondary { padding: 12px 17px; background: var(--teal); }
button.secondary.small { padding: 9px 13px; font-size: .82rem; }
button.danger { padding: 11px 15px; background: var(--coral); }
.alert { display: none; padding: 11px 13px; border-radius: 10px; margin-bottom: 16px; font-size: .9rem; }
.alert.show { display: block; animation: rise .3s ease both; }
.alert.error { color: #a53e35; border: 1px solid #efb5aa; background: #fff0ed; }
.alert.success { color: #176b65; border: 1px solid #a7d9d3; background: #eaf8f5; }
.alert#toast { position: fixed; right: 24px; bottom: 24px; z-index: 5; max-width: min(360px, calc(100vw - 32px)); margin: 0; box-shadow: var(--shadow); }
.dashboard-shell { align-items: flex-start; padding-top: 34px; padding-bottom: 34px; }
.dashboard { padding: 28px; border-radius: 26px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 28px; }
.eyebrow { display: block; margin-bottom: 5px; color: var(--teal); font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; }
.user-meta { display: flex; flex-direction: column; gap: 2px; }
.user-meta strong { color: var(--navy); font: 700 clamp(1.45rem, 3vw, 2.3rem) 'Space Grotesk', sans-serif; }
.user-meta span:last-child { color: var(--muted); }
.today { color: var(--muted); font-size: .85rem; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 22px; }
.stat-card { position: relative; overflow: hidden; min-height: 128px; padding: 19px; border-radius: 17px; color: #fff; background: var(--navy); animation: rise .55s ease both; }
.stat-card:nth-child(2) { background: var(--teal); animation-delay: .08s; }
.stat-card:nth-child(3) { color: var(--navy); background: #f3c86c; animation-delay: .16s; }
.stat-card::after { content: ''; position: absolute; width: 90px; height: 90px; right: -28px; bottom: -35px; border: 14px solid rgba(255,255,255,.16); border-radius: 50%; }
.stat-card span { position: relative; z-index: 1; font-size: .84rem; opacity: .8; }
.stat-card strong { position: relative; z-index: 1; display: block; margin-top: 12px; font: 700 clamp(2rem, 5vw, 3rem) 'Space Grotesk', sans-serif; }
.grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 18px; margin-bottom: 20px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 17px; padding: 20px; animation: card-in .55s ease both; }
.grid .card:nth-child(2) { animation-delay: .08s; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 17px; }
.card-header h3 { margin: 0; color: var(--navy); font: 600 1.12rem 'Space Grotesk', sans-serif; }
.section-card { margin-top: 20px; animation-delay: .16s; }
.section-card:nth-of-type(4) { animation-delay: .24s; }
.section-card:nth-of-type(5) { animation-delay: .32s; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-panel { background: #fffdfa; }
.report-controls { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 16px; margin-bottom: 18px; }
.form-group.compact { margin-bottom: 0; }
.admin-actions { display: flex; gap: 12px; margin-top: 18px; }
.report-container { margin-top: 18px; }
.report-summary { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.report-summary strong { color: var(--navy); font: 700 1.08rem 'Space Grotesk', sans-serif; }
.report-period { color: var(--muted); font-size: .8rem; }
.report-stats { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: .88rem; }
.geofence-box { margin-bottom: 18px; padding: 10px 12px; border-radius: 12px; background: #edf7f5; color: var(--navy); font-size: .88rem; }
.mini-action { border-radius: 8px; font-size: .75rem; padding: 7px 10px; }
.mini-action.edit { background: var(--teal); }
.mini-action.delete { background: var(--coral); }
.action-stack { display: flex; gap: 8px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fffaf1; }
.report-total td { color: var(--navy); font-weight: 700; border-top: 2px solid var(--line); }
.badge { display: inline-block; padding: 6px 10px; border-radius: 999px; font-size: .7rem; font-weight: 700; white-space: nowrap; }
.badge.success { color: #176b65; background: #e5f6f2; }
.badge.warning { color: #946c12; background: #fff4d5; }
.badge.danger { color: #a53e35; background: #ffebe7; }
.empty-state { margin: 0; padding: 20px 0 4px; color: var(--muted); text-align: center; }
.loading { color: var(--muted); font-size: .9rem; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes card-in { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes loading-shine { from { transform: translateX(-125%); } to { transform: translateX(125%); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
@media (max-width: 760px) {
  .app-shell { padding: 16px; }
  .auth-card { padding: 30px 22px; }
  .dashboard { padding: 18px; border-radius: 20px; }
  .topbar { flex-direction: column; margin-bottom: 22px; }
  .topbar button { width: 100%; }
  .stats-grid, .grid, .form-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 104px; }
  .card { padding: 16px; }
  .card-header { align-items: flex-start; }
  .admin-actions { flex-direction: column; }
  .table-wrap { margin: 0 -4px; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tbody tr { padding: 12px 0; border-bottom: 1px solid var(--line); }
  tbody tr:last-child { border-bottom: 0; }
  td { display: flex; justify-content: space-between; gap: 16px; padding: 5px 4px; border: 0; text-align: right; }
  td::before { color: var(--muted); content: attr(data-label); font-size: .72rem; font-weight: 700; text-align: left; text-transform: uppercase; }
  .table-wrap { overflow-x: scroll; }
}
