:root {
  --a-bg: #f6f7f7;
  --a-surface: #ffffff;
  --a-surface-2: #f1f3f2;
  --a-ink: #16181a;
  --a-ink-soft: #484d50;
  --a-gray: #71777a;
  --a-gray-soft: #a5aaac;
  --a-border: #e2e5e3;
  --a-border-soft: #edf0ee;
  --a-green: #239735;
  --a-green-dark: #187928;
  --a-green-bg: #e9f7eb;
  --a-red: #c8323b;
  --a-red-bg: #fdecee;
  --a-amber: #9a6500;
  --a-amber-bg: #fff4d7;
  --a-blue: #2864b0;
  --a-blue-bg: #eaf2fc;
  --a-radius: 10px;
  --a-radius-lg: 14px;
  --a-shadow-sm: 0 1px 2px rgba(20, 24, 22, .04);
  --a-shadow-md: 0 18px 50px rgba(20, 24, 22, .15);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--a-bg); }
body.a-page { min-height: 100vh; margin: 0; color: var(--a-ink); background: var(--a-bg); font-family: Inter, Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 13.5px; letter-spacing: 0; }
.a-page button, .a-page input, .a-page select, .a-page textarea { font: inherit; letter-spacing: 0; }
.a-page button, .a-page summary { cursor: pointer; }
.a-page a { color: inherit; text-decoration: none; }
.a-page h1, .a-page h2, .a-page h3, .a-page p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.a-shell { min-height: 100vh; display: flex; }
.a-side { position: fixed; inset: 0 auto 0 0; width: 232px; display: flex; flex-direction: column; z-index: 20; background: var(--a-surface); border-right: 1px solid var(--a-border); }
.a-brand { height: 64px; display: flex; align-items: center; gap: 9px; padding: 0 18px; border-bottom: 1px solid var(--a-border-soft); font-size: 16px; font-weight: 800; }
.a-brand img { width: 28px; height: 28px; object-fit: contain; }
.a-brand small { margin-left: auto; padding: 3px 6px; border-radius: 6px; color: var(--a-gray); background: var(--a-surface-2); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.a-nav { flex: 1; padding: 14px 10px; overflow-y: auto; }
.a-nav-label { padding: 14px 10px 6px; color: var(--a-gray-soft); font-size: 10.5px; font-weight: 800; text-transform: uppercase; }
.a-nav-link { min-height: 38px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 2px 0; border-radius: 8px; color: var(--a-ink-soft); font-weight: 650; }
.a-nav-link:hover { background: var(--a-surface-2); color: var(--a-ink); }
.a-nav-link.is-active { color: var(--a-green-dark); background: var(--a-green-bg); }
.a-nav-link svg { flex: 0 0 auto; }
.a-side-foot { display: flex; align-items: center; gap: 9px; padding: 14px; border-top: 1px solid var(--a-border); }
.a-admin-avatar { width: 34px; height: 34px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: #26352b; color: white; font-size: 11px; font-weight: 800; }
.a-admin-avatar.small { width: 28px; height: 28px; font-size: 9px; }
.a-admin-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.a-admin-meta strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.a-admin-meta span { color: var(--a-gray); font-size: 11px; }
.a-main { width: calc(100% - 232px); min-width: 0; margin-left: 232px; }
.a-body { width: 100%; max-width: 1500px; min-height: 100vh; padding: 28px 30px 60px; }
.a-mobile-head { display: none; }

.a-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.a-page-head h1 { margin-top: 2px; font-size: 25px; line-height: 1.2; }
.a-page-head > div > p:last-child { margin-top: 6px; color: var(--a-gray); }
.a-eyebrow { color: var(--a-green-dark); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.a-period-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.a-btn { min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 12px; border: 1px solid transparent; border-radius: 8px; font-weight: 750; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.a-btn-primary { color: white; background: var(--a-green); }
.a-btn-primary:hover { background: var(--a-green-dark); }
.a-btn-default { color: var(--a-ink); background: var(--a-surface); border-color: var(--a-border); }
.a-btn-default:hover { background: var(--a-surface-2); border-color: var(--a-gray-soft); }
.a-btn-danger { color: var(--a-red); background: var(--a-red-bg); }
.a-btn-ghost { color: var(--a-ink-soft); background: transparent; }
.a-btn-sm { min-height: 29px; padding: 5px 9px; font-size: 12px; }
.a-btn-block { width: 100%; }
.a-icon-btn { width: 32px; height: 32px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--a-border); border-radius: 8px; color: var(--a-ink-soft); background: var(--a-surface); }
.a-icon-btn:hover { color: var(--a-ink); background: var(--a-surface-2); }
.a-icon-btn[disabled] { opacity: .4; cursor: default; }

.a-field { display: flex; flex-direction: column; gap: 6px; }
.a-field > span, .a-label { color: var(--a-ink-soft); font-size: 12px; font-weight: 750; }
.a-input, .a-select, .a-textarea { width: 100%; min-height: 36px; padding: 8px 10px; border: 1px solid var(--a-border); border-radius: 8px; color: var(--a-ink); background: var(--a-surface); }
.a-textarea { min-height: 90px; resize: vertical; }
.a-input:focus, .a-select:focus, .a-textarea:focus { outline: none; border-color: var(--a-green); box-shadow: 0 0 0 3px rgba(35, 151, 53, .12); }
.a-form-stack { display: flex; flex-direction: column; gap: 15px; }
.a-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.a-form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 8px; }
.a-hint { color: var(--a-gray); font-size: 11.5px; }

.a-flash { margin-bottom: 16px; padding: 11px 13px; border: 1px solid; border-radius: 9px; font-weight: 650; }
.a-flash.success { color: var(--a-green-dark); background: var(--a-green-bg); border-color: #c8e9cd; }
.a-flash.danger { color: var(--a-red); background: var(--a-red-bg); border-color: #f2cbd0; }

.a-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.a-kpi { min-width: 0; padding: 16px; border: 1px solid var(--a-border); border-radius: var(--a-radius-lg); background: var(--a-surface); box-shadow: var(--a-shadow-sm); }
.a-kpi span { display: block; color: var(--a-gray); font-size: 12px; font-weight: 700; }
.a-kpi strong { display: block; margin: 7px 0 5px; overflow-wrap: anywhere; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.a-kpi small { color: var(--a-gray-soft); font-size: 11px; }

.a-card { margin-bottom: 18px; overflow: hidden; border: 1px solid var(--a-border); border-radius: var(--a-radius-lg); background: var(--a-surface); box-shadow: var(--a-shadow-sm); }
.a-card-head { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--a-border-soft); }
.a-card-head h2 { font-size: 14.5px; }
.a-card-head p { margin-top: 3px; color: var(--a-gray); font-size: 11.5px; }
.a-card-body { padding: 18px; }

.a-calendar-nav { display: flex; align-items: center; gap: 10px; }
.a-calendar-nav strong { width: 145px; text-align: center; font-size: 13px; }
.a-calendar-weekdays, .a-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.a-calendar-weekdays { padding: 8px 12px; border-bottom: 1px solid var(--a-border-soft); color: var(--a-gray); background: var(--a-surface-2); text-align: center; font-size: 10.5px; font-weight: 800; text-transform: uppercase; }
.a-calendar-grid { padding: 10px; gap: 6px; }
.a-calendar-day { min-height: 68px; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 8px; border: 1px solid transparent; border-radius: 9px; background: var(--a-surface); }
.a-calendar-day:hover { border-color: var(--a-border); background: var(--a-surface-2); }
.a-calendar-day > span { font-weight: 750; }
.a-calendar-day strong { padding: 3px 6px; border-radius: 5px; color: var(--a-green-dark); background: var(--a-green-bg); font-size: 10px; }
.a-calendar-day.is-muted { color: var(--a-gray-soft); }
.a-calendar-day.is-selected { border-color: var(--a-green); background: var(--a-green-bg); }
.a-calendar-day.is-today > span { width: 25px; height: 25px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: white; background: var(--a-ink); }

.a-table-wrap { width: 100%; overflow-x: auto; }
.a-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.a-table th { padding: 10px 13px; color: var(--a-gray); background: var(--a-surface-2); border-bottom: 1px solid var(--a-border); text-align: left; font-size: 10.5px; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.a-table td { padding: 11px 13px; border-bottom: 1px solid var(--a-border-soft); vertical-align: middle; }
.a-table tbody tr:last-child td { border-bottom: 0; }
.a-table tbody tr:hover { background: #fafbfa; }
.a-table td > strong, .a-table td > small { display: block; }
.a-table td > small { max-width: 360px; margin-top: 2px; overflow: hidden; color: var(--a-gray); text-overflow: ellipsis; white-space: nowrap; }
.a-table-actions { display: flex; justify-content: flex-end; gap: 5px; }
.a-mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.a-badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 750; white-space: nowrap; }
.a-badge.green { color: var(--a-green-dark); background: var(--a-green-bg); }
.a-badge.red { color: var(--a-red); background: var(--a-red-bg); }
.a-badge.amber { color: var(--a-amber); background: var(--a-amber-bg); }
.a-badge.blue { color: var(--a-blue); background: var(--a-blue-bg); }
.a-badge.gray { color: var(--a-ink-soft); background: var(--a-surface-2); border: 1px solid var(--a-border); }
.a-empty { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 30px; color: var(--a-gray); text-align: center; }
.a-empty svg { margin-bottom: 5px; color: var(--a-gray-soft); }
.a-empty h3 { color: var(--a-ink); font-size: 14px; }
.a-empty p { font-size: 12px; }
.a-activity-list > div { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--a-border-soft); }
.a-activity-list > div:last-child { border-bottom: 0; }
.a-activity-list p { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.a-activity-list small { width: 100%; color: var(--a-gray); }

.a-toolbar { display: flex; align-items: flex-end; gap: 9px; margin-bottom: 14px; flex-wrap: wrap; }
.a-toolbar .a-field { min-width: 150px; }
.a-toolbar .a-field.a-grow { min-width: 240px; flex: 1; }
.a-tabs { display: flex; gap: 18px; margin-bottom: 16px; border-bottom: 1px solid var(--a-border); overflow-x: auto; }
.a-tabs a { padding: 10px 1px; color: var(--a-gray); border-bottom: 2px solid transparent; font-weight: 750; white-space: nowrap; }
.a-tabs a.is-active { color: var(--a-ink); border-color: var(--a-green); }
.a-pager { display: flex; align-items: center; justify-content: space-between; padding: 11px 13px; border-top: 1px solid var(--a-border); color: var(--a-gray); }
.a-detail-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, .75fr); gap: 18px; }
.a-detail-grid > * { min-width: 0; }
.a-stat-list { display: grid; gap: 0; }
.a-stat-row { display: grid; grid-template-columns: minmax(120px, .7fr) minmax(0, 1fr); gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--a-border-soft); }
.a-stat-row:last-child { border-bottom: 0; }
.a-stat-row dt { color: var(--a-gray); }
.a-stat-row dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.a-danger-zone { border-color: #f0c9cd; }
.a-danger-zone .a-card-head { background: #fffafb; }
.a-inline-form { display: flex; align-items: center; gap: 6px; }
.a-small-input { width: 62px; min-height: 30px; padding: 5px 7px; }
.a-action-menu { position: relative; }
.a-action-menu > summary { list-style: none; }
.a-action-menu > summary::-webkit-details-marker { display: none; }
.a-popover { width: 310px; position: absolute; top: calc(100% + 7px); left: 0; z-index: 40; padding: 14px; border: 1px solid var(--a-border); border-radius: 10px; background: var(--a-surface); box-shadow: var(--a-shadow-md); }
.a-popover.right { right: 0; left: auto; }
.a-json-details summary { color: var(--a-blue); font-weight: 700; }
.a-json-details pre { width: min(520px, 70vw); max-height: 280px; margin: 8px 0 0; padding: 10px; overflow: auto; border-radius: 8px; color: #e9f2ec; background: #1d2420; font-size: 10.5px; white-space: pre-wrap; }

.a-auth-shell { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; background: #eff2f0; }
.a-auth-shell > .a-flash { width: min(100%, 400px); }
.a-login-card { width: min(100%, 400px); padding: 26px; border: 1px solid var(--a-border); border-radius: var(--a-radius-lg); background: var(--a-surface); box-shadow: var(--a-shadow-md); }
.a-login-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 28px; }
.a-login-brand img { width: 38px; height: 38px; object-fit: contain; }
.a-login-brand div { display: flex; flex-direction: column; }
.a-login-brand strong { font-size: 17px; }
.a-login-brand span { color: var(--a-gray); font-size: 11px; }
.a-login-copy { margin-bottom: 20px; }
.a-login-copy h1 { font-size: 23px; }
.a-login-copy p { margin-top: 5px; color: var(--a-gray); }

@media (max-width: 1100px) {
  .a-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .a-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .a-side { display: none; }
  .a-main { width: 100%; margin-left: 0; }
  .a-mobile-head { height: 54px; display: flex; align-items: center; gap: 9px; padding: 0 14px; position: sticky; top: 0; z-index: 30; background: var(--a-surface); border-bottom: 1px solid var(--a-border); }
  .a-mobile-head > img { width: 25px; height: 25px; object-fit: contain; }
  .a-mobile-head > strong { flex: 1; }
  .a-mobile-head details { position: relative; }
  .a-mobile-head summary { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; list-style: none; border: 1px solid var(--a-border); border-radius: 8px; }
  .a-mobile-head summary::-webkit-details-marker { display: none; }
  .a-mobile-head details nav { width: 220px; display: grid; position: absolute; top: 40px; right: 0; padding: 8px; border: 1px solid var(--a-border); border-radius: 10px; background: var(--a-surface); box-shadow: var(--a-shadow-md); }
  .a-mobile-head details nav a { padding: 9px; border-radius: 7px; font-weight: 700; }
  .a-mobile-head details nav form { margin: 0; }
  .a-mobile-head details nav form button { width: 100%; padding: 9px; border: 0; border-radius: 7px; color: var(--a-red); background: transparent; text-align: left; font-weight: 700; }
  .a-mobile-head details nav a:hover { background: var(--a-surface-2); }
  .a-mobile-head details nav form button:hover { background: var(--a-red-bg); }
  .a-body { padding: 20px 14px 50px; }
  .a-page-head { align-items: flex-start; flex-direction: column; }
  .a-period-form { width: 100%; }
  .a-period-form > * { flex: 1; }
  .a-calendar-day { min-height: 55px; padding: 6px; }
  .a-calendar-day strong { font-size: 0; }
  .a-calendar-day strong::after { content: "•"; font-size: 14px; }
  .a-form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .a-kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .a-kpi { padding: 13px; }
  .a-kpi strong { font-size: 19px; }
  .a-calendar-card .a-card-head { align-items: flex-start; flex-direction: column; }
  .a-calendar-nav { width: 100%; justify-content: space-between; }
  .a-calendar-grid { gap: 2px; padding: 6px; }
  .a-calendar-day { min-height: 48px; }
  .a-card-head { align-items: flex-start; }
}
