:root {
  color-scheme: light;
  --green-950: #103a21;
  --green-900: #174d2b;
  --green-800: #215e32;
  --green-700: #2e7540;
  --green-100: #e8f3e9;
  --ink: #17231b;
  --muted: #64736a;
  --line: #e3e9e4;
  --surface: #ffffff;
  --page: #f4f7f4;
  --danger: #a23232;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  -webkit-tap-highlight-color: transparent;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #8ccf8e;
  outline-offset: 2px;
}

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  display: flex;
  width: 252px;
  flex-direction: column;
  padding: 22px 16px 16px;
  color: #fff;
  background: linear-gradient(165deg, var(--green-900), #397642 68%, #6f9c43);
  transform: translateX(-100%);
  transition: transform 180ms ease;
}
.sidebar.is-open { transform: translateX(0); }
.brand {
  display: grid;
  min-height: 92px;
  align-content: center;
  justify-items: start;
  gap: 8px;
  padding: 0 10px 20px;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid #ffffff2b;
}
.brand-logo {
  display: block;
  width: 142px;
  height: 45px;
  object-fit: contain;
  object-position: left center;
  background: #fff;
  border-radius: 9px;
}
.brand-name { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.brand-name b { color: #d7edb9; }
.navigation { display: grid; gap: 6px; margin-top: 20px; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 12px;
  border: 0;
  border-radius: 10px;
  color: #f4fbf1;
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
}
.nav-link span { width: 20px; color: #d4efad; text-align: center; font-size: 17px; }
.nav-link:hover, .nav-link.is-active { color: var(--green-950); background: #fff; }
.nav-link.is-active span { color: var(--green-800); }
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 16px 10px 4px;
  border-top: 1px solid #ffffff2b;
  color: #e2f0db;
  font-size: 12px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #a8e890; }

.workspace { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  min-height: 78px;
  align-items: center;
  gap: 14px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: #ffffffed;
  backdrop-filter: blur(12px);
}
.menu-button, .icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--ink);
  background: var(--surface);
  font-size: 19px;
}
.page-title { min-width: 0; }
.eyebrow { margin: 0 0 3px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .13em; }
h1, h2, h3, p { margin-top: 0; }
.page-title h1 { margin: 0; font-size: 19px; line-height: 1.2; }
.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.today-label { color: var(--muted); font-size: 12px; }
.content { width: min(100%, 1500px); min-height: calc(100vh - 136px); margin: 0 auto; padding: 26px 20px 34px; }
.footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-size: 11px;
}
.demo-banner {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 30;
  display: flex;
  max-width: min(620px, calc(100vw - 24px));
  align-items: center;
  gap: 6px;
  padding: 11px 12px;
  border: 1px solid #e8d59b;
  border-radius: 12px;
  color: #55420c;
  background: #fff8df;
  box-shadow: 0 8px 26px #15251a1c;
  font-size: 11px;
  line-height: 1.45;
}
.demo-banner button { flex: 0 0 auto; margin-left: 4px; border: 0; color: inherit; background: transparent; font-size: 20px; line-height: 1; }

.page-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.page-intro h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.025em; }
.page-intro p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.actions { display: flex; flex-wrap: wrap; gap: 9px; }
.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}
.button-primary { color: #fff; background: var(--green-800); }
.button-primary:hover { background: var(--green-950); }
.button-secondary { border-color: var(--line); color: var(--ink); background: #fff; }
.button-secondary:hover { background: #f4f8f4; }
.button-danger { border-color: #efcaca; color: var(--danger); background: #fff7f7; }
.button-small { min-height: 34px; padding: 7px 11px; font-size: 12px; }
.button:disabled { cursor: not-allowed; opacity: .5; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card, .panel, .table-panel, .notice-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: 0 2px 6px #17351e08;
}
.stat-card { min-height: 134px; padding: 17px; }
.stat-label { margin-bottom: 13px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.stat-value { margin: 0; color: var(--green-900); font-size: clamp(24px, 3vw, 32px); font-weight: 800; letter-spacing: -.04em; }
.stat-caption { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(250px, .8fr); gap: 16px; }
.panel { padding: 18px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-heading h3 { margin: 0; font-size: 15px; }
.panel-heading a, .text-link { color: var(--green-800); font-size: 12px; font-weight: 700; text-decoration: none; }
.panel-heading a:hover, .text-link:hover { text-decoration: underline; }
.empty-state { padding: 28px 12px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.6; }
.empty-state strong { display: block; margin-bottom: 5px; color: var(--ink); font-size: 14px; }
.activity-list, .record-list { display: grid; gap: 9px; }
.activity-row, .record-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid #edf1ed;
  border-radius: 11px;
  background: #fbfcfb;
}
.record-main { min-width: 0; }
.record-main strong { display: block; overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.record-main span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.record-value { flex: 0 0 auto; color: var(--green-800); font-size: 12px; font-weight: 800; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; color: #1e6b3b; background: var(--green-100); font-size: 10px; font-weight: 800; }
.badge-warn { color: #805a0c; background: #fff2cc; }
.badge-danger { color: #8d2929; background: #fde7e7; }
.section-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-heading h2 { margin: 0 0 4px; font-size: 20px; }
.section-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.filter-input { width: min(100%, 300px); min-height: 39px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 14px; border-bottom: 1px solid #edf1ed; font-size: 12px; white-space: nowrap; }
th { color: var(--muted); background: #f8faf8; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.table-empty { padding: 30px 12px; color: var(--muted); text-align: center; }
.financial-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.summary-item { padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.summary-item span { display: block; color: var(--muted); font-size: 11px; }
.summary-item strong { display: block; margin-top: 8px; color: var(--green-900); font-size: 18px; }
.notice-card { padding: 17px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.notice-card h3 { margin: 0 0 6px; color: var(--ink); font-size: 14px; }
.notice-card p:last-child { margin-bottom: 0; }
.settings-warning { margin-top: 16px; }
.setting-list { display: grid; gap: 12px; }
.setting-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong { display: block; font-size: 13px; }
.setting-row p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }

.dialog { width: min(100% - 24px, 520px); max-height: min(88vh, 760px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: #fff; box-shadow: 0 24px 80px #10251845; }
.dialog::backdrop { background: #101a14a6; backdrop-filter: blur(3px); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0; font-size: 18px; }
.icon-button { width: 34px; height: 34px; font-size: 22px; }
.dialog-body { display: grid; gap: 14px; padding: 18px 19px 20px; }
.field { display: grid; gap: 6px; }
.field label { color: #35433a; font-size: 12px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid #dce5dd; border-radius: 9px; color: var(--ink); background: #fff; }
.field textarea { min-height: 82px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.toast-region { position: fixed; top: 92px; right: 14px; z-index: 40; display: grid; gap: 8px; width: min(360px, calc(100vw - 28px)); pointer-events: none; }
.toast { padding: 12px 14px; border-left: 4px solid var(--green-700); border-radius: 9px; color: #fff; background: #203b29; box-shadow: 0 6px 20px #10251828; font-size: 12px; }
.toast.is-error { border-color: #f39b9b; background: #752c2c; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }

@media (min-width: 1000px) {
  .sidebar { transform: translateX(0); }
  .workspace { margin-left: 252px; }
  .menu-button { display: none; }
}
@media (max-width: 760px) {
  .topbar { min-height: 68px; padding: 10px 13px; }
  .content { min-height: calc(100vh - 126px); padding: 20px 13px 28px; }
  .today-label { display: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { min-height: 118px; padding: 13px; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .financial-summary { grid-template-columns: 1fr; }
  .page-intro { display: grid; }
  .page-intro .actions { width: 100%; }
  .page-intro .button { flex: 1 1 auto; }
  .footer { padding: 12px 14px; font-size: 10px; }
  .demo-banner { right: 8px; bottom: 8px; max-width: calc(100vw - 16px); }
}
@media (max-width: 420px) {
  .form-grid { grid-template-columns: 1fr; }
  .topbar-actions .button { padding: 6px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
@media print {
  .sidebar, .topbar, .footer, .demo-banner, .actions, .button, .filter-input { display: none !important; }
  .workspace { margin: 0; }
  .content { width: 100%; padding: 0; }
  body { background: #fff; }
}
