:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #111827;
  background: #f4f6f8;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
.app-shell { width: 100%; max-width: 1050px; margin: 0 auto; padding: 20px; }
.header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.brand { min-width: 0; }
.brand h1 { margin: 0; font-size: 1.45rem; line-height: 1.2; }
.brand p { margin: .25rem 0 0; color: #6b7280; overflow-wrap: anywhere; }
.card { min-width: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; padding: 18px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.grid { display: grid; gap: 16px; min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
label { display: block; min-width: 0; font-weight: 600; font-size: .92rem; }
input, select, textarea { width: 100%; max-width: 100%; margin-top: 6px; border: 1px solid #d1d5db; border-radius: 10px; padding: 11px 12px; background: #fff; color: #111827; }
textarea { min-height: 88px; resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; border: 0; border-radius: 10px; padding: 11px 15px; font-weight: 700; background: #111827; color: #fff; text-align: center; }
.btn.secondary { background: #fff; color: #111827; border: 1px solid #d1d5db; }
.btn.good { background: #166534; }
.btn.bad { background: #991b1b; }
.btn.small { min-height: 36px; padding: 7px 10px; font-size: .84rem; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; min-width: 0; }
.muted { color: #6b7280; }
.error { color: #b91c1c; margin: .6rem 0 0; overflow-wrap: anywhere; }
.success { color: #166534; margin: .6rem 0 0; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.stat { min-width: 0; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px; }
.stat span { display: block; color: #6b7280; font-size: .82rem; }
.stat strong { display: block; margin-top: 5px; font-size: 1.25rem; overflow-wrap: anywhere; }
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; border-bottom: 1px solid #e5e7eb; padding: 11px 9px; font-size: .9rem; vertical-align: top; }
th { color: #6b7280; font-weight: 700; white-space: nowrap; }
td { overflow-wrap: anywhere; }
.badge { display: inline-flex; padding: 4px 8px; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.approved { background: #dcfce7; color: #166534; }
.badge.rejected { background: #fee2e2; color: #991b1b; }
.badge.active { background: #dcfce7; color: #166534; }
.badge.inactive { background: #e5e7eb; color: #4b5563; }
.top-gap { margin-top: 16px; }
.login-card { max-width: 480px; margin: 8vh auto 0; }
.radio-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.radio-item { border: 1px solid #d1d5db; border-radius: 10px; padding: 10px; font-weight: 500; }
.radio-item input { width: auto; margin: 0 6px 0 0; }
.subcard { min-width: 0; background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 12px; padding: 14px; }
.switchline { display: flex; align-items: center; gap: 9px; }
.switchline input { width: auto; margin: 0; }

@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 760px) {
  body { background: #f4f6f8; }
  .app-shell { padding: 10px; }
  .header { align-items: stretch; flex-direction: column; gap: 12px; margin-bottom: 14px; }
  .header > .btn { width: 100%; }
  .brand h1 { font-size: 1.3rem; }
  .card { padding: 14px; border-radius: 13px; }
  .subcard { padding: 12px; }
  .grid-2, .grid-3, .grid-4, .radio-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  .stat { padding: 11px; }
  .stat strong { font-size: 1.1rem; }
  input, select, textarea { font-size: 16px; min-height: 44px; }
  textarea { min-height: 96px; }
  .btn { min-height: 44px; }
  .btn.small { min-height: 40px; }
  .toolbar { align-items: stretch; }
  .toolbar > .btn, .toolbar > a.btn { flex: 1 1 auto; }
  .toolbar > input[type="month"] { width: 100% !important; flex: 1 0 100%; }
  nav.toolbar { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px !important; }
  nav.toolbar .btn { width: 100%; padding-left: 8px; padding-right: 8px; }
  .table-wrap { margin-left: 0; margin-right: 0; padding-bottom: 4px; }
  table { min-width: 650px; }
  th, td { padding: 10px 8px; font-size: .86rem; }
  td .toolbar { flex-wrap: nowrap; align-items: center; }
  td .toolbar .btn { flex: 0 0 auto; }
  .login-card { margin: 20px auto 0; }
}

@media (max-width: 430px) {
  .app-shell { padding: 8px; }
  .card { padding: 12px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat span { font-size: .76rem; }
  .stat strong { font-size: 1rem; }
  nav.toolbar { grid-template-columns: 1fr; }
  table { min-width: 610px; }
}
