:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  color: #26313b;
  background: #f5f6f8;
  font-size: 14px;
  --teal: #3e706e;
  --line: #e4e8eb;
  --muted: #75818c;
  --nav: #1a2730;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible { outline: 3px solid #8dbbb9; outline-offset: 3px; }
input, select, textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  border: 1px solid #d5dce1; border-radius: 7px; background: #fff; color: #26313b;
}
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox] { width: 17px; height: 17px; min-height: 17px; margin: 0; flex-shrink: 0; accent-color: var(--teal); }
input[readonly] { background: #f6f7f8; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px; border: 1px solid #d5dce1; border-radius: 7px;
  background: #fff; color: #283640; font-weight: 600; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: #f4f7f7; border-color: #bbc9ce; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: #315e5c; border-color: #315e5c; }
.btn.small { padding: 8px 14px; }
.link-button { background: none; border: 0; padding: 8px; color: var(--teal); font-weight: 600; border-radius: 6px; }
.link-button:hover { background: #eff6f4; }
.muted, .subtle { color: var(--muted); }
.small-text { font-size: 12px; line-height: 1.65; }
.skip-link { position: fixed; top: -80px; left: 20px; z-index: 150; background: #fff; color: #203733; border-radius: 7px; padding: 12px 16px; }
.skip-link:focus { top: 12px; }

/* One aligned row on desktop; navigation moves to its own row on small screens. */
.topbar {
  position: relative; z-index: 30; display: flex; align-items: center; gap: 18px;
  min-height: 60px; padding: 0 28px; background: var(--nav); color: #bec9cf;
  border-bottom: 1px solid #ffffff08;
}
.brand { display: flex; align-items: center; gap: 11px; font-size: 15px; font-weight: 650; color: #fff; white-space: nowrap; letter-spacing: -.15px; }
.brand svg { width: 18px; height: 18px; color: #b1bfc5; }
.nav-divider { height: 18px; width: 1px; background: #ffffff1c; flex-shrink: 0; }
.nav-label { font-size: 13px; font-weight: 600; color: #eef3f4; }
.nav-links { display: flex; gap: 3px; align-items: center; }
.topbar details { position: relative; }
.topbar summary {
  display: flex; align-items: center; gap: 10px; list-style: none;
  padding: 9px 11px; cursor: pointer; border-radius: 7px;
  font-size: 13px; font-weight: 450; line-height: 20px;
  transition: background .15s, color .15s;
}
.topbar summary::-webkit-details-marker { display: none; }
.topbar summary::after {
  content: ''; width: 6px; height: 6px; margin: -3px 1px 0 2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg); opacity: .75; transition: transform .15s;
}
.topbar summary:hover, .topbar .is-current > summary { background: #ffffff0b; color: #fff; }
.topbar details[open] > summary { background: #ffffff12; color: #fff; }
.topbar details[open] > summary::after { transform: translateY(3px) rotate(225deg); }
.dropdown {
  position: absolute; z-index: 50; top: calc(100% + 10px); left: 0;
  width: 218px; max-width: calc(100vw - 32px); padding: 6px;
  border: 1px solid #e4e9ec; border-radius: 10px; background: #fff; color: #26343e;
  box-shadow: 0 10px 30px #15263216, 0 2px 6px #15263208;
}
.topbar details:not([open]) > .dropdown { display: none; }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-radius: 6px; background: none; font-size: 13px; line-height: 20px; }
.dropdown a:hover, .dropdown button:hover { background: #f1f6f5; }
.dropdown a[aria-current=page] { background: #eaf3f0; color: #315f59; font-weight: 600; }
.topbar .account { display: flex; align-items: center; gap: 13px; margin-left: auto; }
.branch-select {
  width: 196px; min-height: 34px; height: 34px; padding: 5px 10px;
  border: 1px solid #ffffff20; border-radius: 7px; background: #ffffff09;
  color: #edf2f4; font-size: 12px; text-overflow: ellipsis;
}
.branch-select option { background: #26363f; color: #fff; }
.avatar { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: #487674; font-size: 12px; font-weight: 650; color: #fff; }
.account .dropdown { left: auto; right: 0; width: 230px; }
.account summary { padding: 0; border-radius: 50%; }
.account summary::after { display: none; }
.account-name { padding: 11px 12px 14px; margin-bottom: 5px; color: #7c878e; border-bottom: 1px solid var(--line); font-size: 12px; line-height: 1.75; overflow-wrap: anywhere; }
.account-name strong { color: #28343d; font-size: 13px; }

.workspace { max-width: 1480px; padding: 28px 32px; margin: auto; }
.workspace:focus { outline: none; }
.page-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 22px; min-height: 40px; }
.page-heading h1 { font-size: 23px; letter-spacing: -.6px; margin: 0; font-weight: 650; }
.page-heading .subtle { font-size: 12px; }
.page-heading .btn { margin-left: auto; }
.card { border: 1px solid var(--line); background: #fff; border-radius: 11px; box-shadow: 0 1px 3px #14223204; overflow: hidden; }
.toolbar { display: flex; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); align-items: center; background: #fdfefe; }
.toolbar input { max-width: 300px; }
.toolbar select { max-width: 154px; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; background: #f9fafb; color: #7a8590; font-size: 11px; font-weight: 600; letter-spacing: .55px; padding: 13px 16px; white-space: nowrap; text-transform: uppercase; }
td { border-top: 1px solid #edf0f2; padding: 13px 16px; line-height: 1.55; vertical-align: middle; }
tbody tr:hover { background: #fcfdfd; }
td:first-child { font-weight: 500; }
td strong { font-weight: 600; }
.row-action { text-align: right; white-space: nowrap; }
.badge { display: inline-block; padding: 3px 9px; font-size: 11px; border-radius: 20px; background: #eaf4ed; color: #4b7d5b; font-weight: 600; }
.badge.inactive { background: #f0f1f2; color: #7b8188; }
.table-footer { padding: 12px 16px; color: #87919a; font-size: 11px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.empty { padding: 54px 24px; text-align: center; color: #7c8790; font-weight: 400; }

/* Keep the home cards compact, with one consistent content width. */
.home { max-width: 1080px; margin: 26px auto 0; }
.home h1 { font-size: 29px; line-height: 1.25; font-weight: 650; letter-spacing: -.85px; margin: 0 0 10px; }
.home-intro { font-size: 15px; color: #84909a; margin: 0 0 32px; line-height: 1.55; }
.module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.module-card {
  display: block; min-width: 0; min-height: 170px; padding: 20px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 2px 3px #14223203;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.module-card:hover { border-color: #c5d8d3; transform: translateY(-2px); box-shadow: 0 6px 18px #142b240a; }
.module-card-top { display: flex; align-items: center; justify-content: space-between; }
.card-arrow { font-size: 20px; color: #c5cdd2; line-height: 1; transition: color .15s; }
.module-card:hover .card-arrow { color: var(--teal); }
.module-card h2 { font-size: 16px; margin: 17px 0 6px; font-weight: 600; letter-spacing: -.2px; }
.module-card p { color: #82909b; font-size: 13px; line-height: 1.55; margin: 0; }
.module-icon { width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; border-radius: 11px; background: #437572; color: #fff; }
.module-icon svg { width: 25px; height: 25px; }
.module-icon.blue { background: #5b68c5; }
.module-icon.slate { background: #596578; }
.module-icon.amber { background: #b4874e; }
.home-note { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; margin-top: 30px; padding-top: 18px; border-top: 1px solid #e8ecef; color: #8a959e; font-size: 11px; line-height: 1.7; }
.footer-separator { padding: 0 9px; color: #b3bec5; }

.login-screen { min-height: 100vh; background: linear-gradient(135deg, #3b716d, #193d39); display: grid; place-items: center; padding: 28px; }
.login-card { width: 430px; max-width: 100%; background: #fff; border-radius: 14px; padding: 36px; box-shadow: 0 26px 64px #10292540; }
.login-card h1 { margin: 4px 0 10px; font-size: 27px; letter-spacing: -.7px; font-weight: 650; }
.login-card h1 span { color: var(--teal); }
.login-card .subtitle { margin: 0 0 28px; color: #829099; }
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 20px; }
.field label { font-size: 12px; color: #697780; font-weight: 600; }
.login-card .btn { width: 100%; margin-top: 4px; }
.login-footer { text-align: center; font-size: 10px; letter-spacing: 1.1px; color: #8b9996; margin: 24px 0 0; }
.error { padding: 12px 14px; background: #fff1ef; color: #a03f32; border: 1px solid #f3d5d0; border-radius: 7px; font-size: 13px; line-height: 1.55; margin: 0 0 20px; }
.error:empty { display: none; }
.notice { background: #edf5f4; border: 1px solid #d6e8e5; color: #466d68; padding: 14px 17px; border-radius: 9px; font-size: 13px; line-height: 1.65; margin-bottom: 22px; }
.profile { max-width: 580px; padding: 28px; }
.profile h2 { font-size: 18px; font-weight: 600; }
.profile p { line-height: 1.65; }
.profile hr { border: 0; border-top: 1px solid var(--line); margin: 25px 0; }
.info-row { display: flex; justify-content: space-between; gap: 20px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.loading { padding: 60px; text-align: center; color: var(--muted); }
dialog { position: fixed; left: auto; right: 0; top: 0; bottom: 0; margin: 0; width: 640px; max-width: 100%; max-height: 100%; height: 100dvh; border: 0; padding: 0; box-shadow: -12px 0 48px #101a221a; color: #26313b; }
dialog::backdrop { background: #1c273347; }
dialog form { height: 100%; display: flex; flex-direction: column; }
.drawer-heading { padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.drawer-heading h2 { font-size: 18px; font-weight: 600; margin: 0; }
.close { display: grid; place-items: center; width: 32px; height: 32px; background: none; border: 0; font-size: 24px; color: #89949c; border-radius: 6px; }
.close:hover { background: #f0f4f4; color: #26343e; }
.drawer-body { padding: 25px; overflow: auto; flex: 1; }
.drawer-footer { padding: 16px 24px; border-top: 1px solid var(--line); background: #fafbfc; display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.full { grid-column: 1/-1; }
.check { display: flex; gap: 10px; align-items: center; line-height: 1.55; font-size: 13px; cursor: pointer; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; margin-bottom: 26px; }
.group-label { font-size: 11px; letter-spacing: .65px; font-weight: 600; color: #89929a; margin: 26px 0 17px; text-transform: uppercase; }
.check-help { font-size: 12px; color: #84919b; line-height: 1.65; margin: 12px 0 24px; }
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #213f3e; color: white; border-radius: 9px; padding: 12px 20px; box-shadow: 0 8px 25px #122a2929; z-index: 100; font-size: 13px; max-width: 90%; display: none; }
#toast.visible { display: block; }
details.audit-detail summary { cursor: pointer; color: var(--teal); }
.audit-detail pre { white-space: pre-wrap; max-width: 400px; font-size: 12px; }
code { font-size: 12px; }
.page-error { margin: 25px 0; }

@media (max-width: 1100px) {
  .topbar { gap: 12px; padding: 0 20px; }
  .nav-divider, .nav-label { display: none; }
  .topbar summary { padding: 9px; }
  .branch-select { width: 180px; }
  .workspace { padding: 26px 24px; }
  .module-card { padding: 18px; }
}
@media (max-width: 820px) {
  .topbar { padding: 12px 20px 0; flex-wrap: wrap; gap: 11px; }
  .nav-links { order: 3; width: 100%; border-top: 1px solid #ffffff10; padding: 7px 0 8px; }
  .topbar .account { gap: 12px; }
  .nav-links .dropdown { top: calc(100% + 6px); }
  .home { max-width: 640px; margin-top: 16px; }
  .module-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .module-card { min-height: 165px; padding: 20px; }
  .home-note { margin-top: 25px; }
}
@media (max-width: 520px) {
  .topbar { padding: 12px 14px 0; gap: 10px; }
  .brand { font-size: 13px; gap: 7px; }
  .brand svg { width: 16px; height: 16px; }
  .branch-select { width: 135px; font-size: 11px; padding: 5px 7px; }
  .avatar { width: 31px; height: 31px; font-size: 11px; }
  .topbar .account { gap: 9px; }
  .nav-links { justify-content: flex-start; gap: 4px; }
  .topbar summary { font-size: 12px; padding: 8px 9px; }
  .account summary { padding: 0; }
  .nav-links > details:last-child:not(:first-child) .dropdown { left: auto; right: 0; }
  .workspace { padding: 23px 16px; }
  .home { margin-top: 10px; }
  .home h1 { font-size: 26px; }
  .home-intro { font-size: 14px; margin-bottom: 26px; }
  .module-grid { gap: 12px; }
  .module-card { min-height: 163px; padding: 16px; }
  .module-card h2 { font-size: 15px; }
  .module-card p { font-size: 12px; }
  .module-icon { width: 40px; height: 40px; border-radius: 10px; }
  .module-icon svg { width: 23px; height: 23px; }
  .card-arrow { font-size: 18px; }
  .home-note { flex-direction: column; gap: 3px; }
  .page-heading { margin-bottom: 18px; }
  .page-heading h1 { font-size: 22px; }
  .page-heading .subtle { display: none; }
  .toolbar { flex-wrap: wrap; padding: 12px; }
  .toolbar input { max-width: none; flex: 1; min-width: 130px; }
  .toolbar select { max-width: 125px; }
  th, td { padding: 12px; }
  .login-card { padding: 28px; }
  .checks, .form-grid { grid-template-columns: 1fr; }
  .drawer-body { padding: 22px; }
  .profile { padding: 22px; }
}
@media (max-width: 370px) {
  .brand svg { display: none; }
  .branch-select { width: 120px; }
  .topbar { padding-left: 10px; padding-right: 10px; }
  .module-grid { grid-template-columns: 1fr; }
  .module-card { min-height: 155px; }
  .nav-links > details:nth-child(2) .dropdown { left: -60px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
