:root {
  color: #1f2937;
  background: #f6f7f9;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
aside {
  background: #1d2634;
  color: #eef3f8;
  min-height: 100vh;
  padding: 24px 14px;
  position: fixed;
  width: 216px;
}
.brand { color: #fff; font-size: 19px; font-weight: 700; margin: 0 10px 10px; }
.mode {
  border: 1px solid #5e7b64;
  color: #b5e2c0;
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  margin: 0 10px 22px;
  padding: 4px 7px;
}
nav a {
  border-left: 3px solid transparent;
  color: #b8c4d2;
  display: block;
  font-size: 14px;
  margin: 2px 0;
  padding: 11px 10px;
  text-decoration: none;
}
nav a:hover, nav a.active { background: #2c3a4d; border-left-color: #58b78c; color: #fff; }
.logout { bottom: 24px; left: 24px; position: absolute; }
button {
  background: #13795b;
  border: 0;
  color: white;
  cursor: pointer;
  font-weight: 700;
  padding: 10px 15px;
}
button:hover { background: #0d5f46; }
.secondary { background: #39485c; }
.secondary:hover { background: #2c3a4d; }
.logout button { background: #39485c; }
.content { margin-left: 216px; padding: 28px 32px 46px; }
header { align-items: flex-start; display: flex; justify-content: space-between; margin-bottom: 26px; }
h1 { font-size: 25px; margin: 0 0 7px; }
h2 { font-size: 17px; margin: 0; }
header p, .result-note { color: #64748b; font-size: 13px; margin: 0; }
.live { background: #e5f6ee; color: #166534; font-size: 12px; font-weight: 700; padding: 7px 10px; }
.stats { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 28px; }
.stats article { background: #fff; border: 1px solid #dde4ea; min-height: 102px; padding: 18px; }
.stats span { color: #64748b; display: block; font-size: 13px; }
.stats strong { color: #172033; display: block; font-size: 29px; margin-top: 12px; }
.section-heading { align-items: center; display: flex; justify-content: space-between; margin: 0 0 12px; }
.section-heading a { color: #13795b; font-size: 13px; font-weight: 700; text-decoration: none; }
.table-link { color: #13795b; font-weight: 700; text-decoration: none; }
.table-link:hover { text-decoration: underline; }
.filters { display: flex; gap: 8px; margin-bottom: 14px; }
.filters input {
  background: white;
  border: 1px solid #cbd5df;
  min-width: 320px;
  padding: 10px;
}
.result-note { margin-bottom: 12px; }
.table-wrap { background: #fff; border: 1px solid #dde4ea; overflow-x: auto; }
table { border-collapse: collapse; min-width: 850px; width: 100%; }
th, td { border-bottom: 1px solid #e7edf2; font-size: 13px; padding: 11px 12px; text-align: left; vertical-align: middle; }
th { background: #f8fafb; color: #475569; font-size: 12px; white-space: nowrap; }
td { color: #283548; max-width: 250px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.empty { color: #64748b; padding: 30px; text-align: center; }
.status { font-size: 12px; font-weight: 700; padding: 4px 7px; }
.status.paid { background: #e5f6ee; color: #166534; }
.status.unpaid { background: #fff4e5; color: #9a5800; }
.avatar { background: #e7edf2; border-radius: 50%; display: block; height: 28px; object-fit: cover; width: 28px; }
.avatar.placeholder { color: #6b7787; line-height: 28px; text-align: center; }
.avatar.large { height: 54px; width: 54px; }
.avatar.large.placeholder { line-height: 54px; }
.user-card { align-items: center; background: #fff; border: 1px solid #dde4ea; display: flex; justify-content: space-between; margin-bottom: 14px; padding: 18px; }
.user-heading { align-items: center; display: flex; gap: 13px; }
.user-heading h2 { margin: 0 0 6px; }
.user-heading p { color: #64748b; font-size: 13px; margin: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.user-labels { background: #fff; border: 1px solid #dde4ea; margin: 0 0 14px; padding: 14px 16px; }
.user-labels h2 { margin-bottom: 10px; }
.label-list { align-items: center; display: flex; flex-wrap: wrap; gap: 8px; min-height: 28px; }
.label-chip { align-items: center; background: #e8f3ff; color: #155a91; display: inline-flex; font-size: 12px; font-weight: 700; }
.label-chip span { padding: 5px 4px 5px 8px; }
.label-chip button { background: transparent; color: #155a91; font-size: 17px; line-height: 1; padding: 2px 7px 4px; }
.label-chip button:hover { background: #cfe7fb; }
.label-empty { color: #64748b; font-size: 12px; }
.label-add { display: flex; gap: 8px; margin-top: 12px; max-width: 360px; }
.label-add input { border: 1px solid #cbd5df; min-width: 0; padding: 8px; width: 100%; }
.label-add button { flex: 0 0 auto; padding: 8px 11px; }
.detail-grid { display: grid; gap: 1px; grid-template-columns: repeat(3, minmax(0, 1fr)); background: #dde4ea; border: 1px solid #dde4ea; margin-bottom: 18px; }
.detail-grid div { background: #fff; min-height: 76px; padding: 13px; }
.detail-grid span { color: #64748b; display: block; font-size: 12px; margin-bottom: 8px; }
.detail-grid strong { color: #283548; font-size: 13px; font-weight: 700; overflow-wrap: anywhere; }
.operation-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 28px; }
.operation-panel { background: #fff; border: 1px solid #dde4ea; padding: 16px; }
.operation-panel h2 { margin-bottom: 12px; }
.operation-panel label { color: #475569; display: block; font-size: 13px; font-weight: 700; }
.operation-panel input, .operation-panel textarea { border: 1px solid #cbd5df; display: block; font-family: inherit; margin: 7px 0 12px; padding: 9px; width: 100%; }
.operation-panel select, .grant-form select { background: #fff; border: 1px solid #cbd5df; display: block; font-family: inherit; margin: 7px 0 12px; padding: 9px; width: 100%; }
.operation-panel textarea { min-height: 96px; resize: vertical; }
.operation-panel p { color: #64748b; font-size: 12px; line-height: 1.5; margin: 0 0 12px; }
.official-panel { margin-bottom: 26px; max-width: 760px; }
.compact { margin: 0 0 14px; }
.compact div { min-height: 66px; }
.official-grant { background: #fff; border: 1px solid #dde4ea; margin: 0 0 28px; padding: 16px; }
.official-grant h2 { margin-bottom: 10px; }
.official-grant p { color: #64748b; font-size: 12px; line-height: 1.5; margin: 0 0 12px; }
.grant-form { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grant-form label { color: #475569; display: block; font-size: 13px; font-weight: 700; }
.grant-form input { border: 1px solid #cbd5df; display: block; font-family: inherit; margin: 7px 0 0; padding: 9px; width: 100%; }
.grant-form button { align-self: end; grid-column: 1 / -1; justify-self: start; }
.flash { background: #e5f6ee; border: 1px solid #b6e4ca; color: #166534; font-size: 13px; margin-bottom: 16px; padding: 11px 13px; }
.pager { align-items: center; display: flex; gap: 12px; justify-content: flex-end; margin-top: 16px; }
.pager a { background: #fff; border: 1px solid #ccd6df; color: #13795b; font-size: 13px; padding: 8px 10px; text-decoration: none; }
.pager span { color: #64748b; font-size: 13px; }
.login-body { align-items: center; background: #eaf0f3; display: flex; justify-content: center; min-height: 100vh; }
.login-panel { background: white; border: 1px solid #d7e0e6; padding: 34px; width: min(390px, calc(100vw - 32px)); }
.login-panel .brand { color: #1d2634; margin: 0 0 7px; }
.login-panel p { color: #64748b; font-size: 14px; margin: 0 0 24px; }
.login-panel label { color: #475569; display: block; font-size: 13px; font-weight: 700; margin: 14px 0; }
.login-panel input { border: 1px solid #cbd5df; display: block; margin-top: 7px; padding: 10px; width: 100%; }
.login-panel button { margin-top: 8px; width: 100%; }
.error { background: #fff0f0; color: #aa2020; font-size: 13px; margin-bottom: 15px; padding: 10px; }

@media (max-width: 760px) {
  aside { min-height: auto; padding: 14px; position: static; width: 100%; }
  .brand, .mode { margin-left: 0; }
  nav { display: flex; overflow-x: auto; }
  nav a { border-bottom: 3px solid transparent; border-left: 0; white-space: nowrap; }
  nav a:hover, nav a.active { border-bottom-color: #58b78c; border-left-color: transparent; }
  .logout { display: none; }
  .content { margin-left: 0; padding: 22px 16px 36px; }
  header { gap: 14px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters input { min-width: 0; width: 100%; }
  .user-card { align-items: flex-start; flex-direction: column; gap: 13px; }
  .badges { justify-content: flex-start; }
  .detail-grid, .operation-grid, .grant-form { grid-template-columns: 1fr; }
  .label-add { max-width: none; }
}
