:root{
  --bg:#f4f7fb;
  --surface:#ffffff;
  --surface-soft:#f8fafc;
  --text:#172033;
  --muted:#667085;
  --line:#e4e9f1;
  --primary:#173f7a;
  --primary-hover:#245da8;
  --success:#067647;
  --warning:#a15c00;
  --danger:#b42318;
  --info:#175cd3;
  --shadow:0 14px 38px rgba(23,32,51,.08);
  --radius:18px;
}

*{box-sizing:border-box}
html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}
body{
  margin:0;
  min-width:320px;
  background:var(--bg);
  color:var(--text);
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  line-height:1.55;
}
button,input,select,textarea{font:inherit}
a{color:var(--primary);text-decoration:none}
a:hover{text-decoration:none}
img{max-width:100%;height:auto}
.container{width:min(1160px,calc(100% - 32px));margin:0 auto}

.topbar{
  position:sticky;
  top:0;
  z-index:50;
  background:rgba(255,255,255,.96);
  border-bottom:1px solid var(--line);
  box-shadow:0 4px 18px rgba(23,32,51,.04);
}
.topbar-inner{
  min-height:72px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
}
.brand{display:flex;align-items:center;gap:11px;min-width:0;color:var(--text);font-weight:850}
.brand-mark{
  flex:0 0 auto;
  display:grid;
  place-items:center;
  width:46px;
  height:36px;
  border-radius:11px;
  background:linear-gradient(135deg,var(--primary),var(--primary-hover));
  color:#fff;
  font-size:14px;
  letter-spacing:.08em;
  box-shadow:0 8px 18px rgba(23,63,122,.2);
}
.brand-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.nav{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.nav a{
  display:inline-flex;
  align-items:center;
  min-height:40px;
  padding:8px 11px;
  border-radius:10px;
  color:#344054;
  font-size:14px;
  font-weight:750;
  white-space:nowrap;
}
.nav a:hover{background:#f1f5f9;color:var(--primary)}

.page{min-height:calc(100vh - 144px);padding:42px 0 72px}
.footer{padding:26px 0;border-top:1px solid var(--line);background:#fff;color:var(--muted);font-size:14px}

h1,h2,h3{margin:0 0 12px;line-height:1.17}
h1{font-size:clamp(34px,5vw,58px);letter-spacing:-.04em}
h2{font-size:26px;letter-spacing:-.025em}
h3{font-size:19px}
p{margin:0 0 14px}
p:last-child{margin-bottom:0}
.eyebrow{margin-bottom:8px;color:var(--primary-hover);font-size:12px;font-weight:850;letter-spacing:.13em;text-transform:uppercase}
.lead{max-width:780px;color:#465167;font-size:20px}
.muted{color:var(--muted)}

.card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:24px;
  box-shadow:var(--shadow);
}
.section{margin-top:28px}
.hero{display:grid;grid-template-columns:minmax(0,1.55fr) minmax(280px,.75fr);gap:34px;align-items:center;padding:28px 0 18px}
.hero-panel{padding:30px}
.status-dot{display:inline-block;width:12px;height:12px;border-radius:50%;margin-right:8px}
.status-dot.open{background:#12a66a;box-shadow:0 0 0 6px rgba(18,166,106,.12)}
.status-dot.closed{background:#d92d20;box-shadow:0 0 0 6px rgba(217,45,32,.1)}
.step{margin-bottom:18px;color:var(--primary-hover);font-size:13px;font-weight:900}
.notice{border-left:5px solid var(--primary-hover)}
.notice.small{margin-top:14px;padding:15px 18px}

.actions{display:flex;flex-wrap:wrap;gap:12px;margin-top:24px}
.actions.centered{justify-content:center}
.btn{
  appearance:none;
  -webkit-appearance:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
  padding:11px 17px;
  border:1px solid var(--line);
  border-radius:12px;
  background:#fff;
  color:var(--text);
  cursor:pointer;
  font-weight:780;
  text-align:center;
  transition:transform .16s ease,box-shadow .16s ease,background .16s ease;
}
.btn:hover{transform:translateY(-1px);box-shadow:0 8px 20px rgba(23,63,122,.12)}
.btn:disabled,.btn-disabled{opacity:.52;cursor:not-allowed;transform:none!important;box-shadow:none!important}
.btn-primary{border-color:var(--primary);background:var(--primary);color:#fff}
.btn-primary:hover{background:var(--primary-hover)}
.btn-secondary{background:#f8fafc}
.btn-small{min-height:36px;padding:7px 11px;border-radius:9px;font-size:13px}
.btn.danger{border-color:#f0b4ae;color:var(--danger)}
.full{width:100%}

.grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}
.grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}
.form-shell{display:grid;grid-template-columns:minmax(240px,.75fr) minmax(0,1.4fr);gap:28px;align-items:start}
.stack{display:flex;flex-direction:column;gap:17px}
.stack-gap{display:flex;flex-direction:column;gap:20px}

label{display:flex;flex-direction:column;gap:7px;color:#344054;font-size:14px;font-weight:720}
input,select,textarea{
  width:100%;
  min-height:46px;
  padding:12px 13px;
  border:1px solid #cbd3df;
  border-radius:11px;
  outline:none;
  background:#fff;
  color:var(--text);
  transition:border-color .15s,box-shadow .15s;
}
input[type="file"]{padding:10px;background:#f8fafc}
textarea{min-height:120px;resize:vertical}
input:focus,select:focus,textarea:focus{border-color:var(--primary-hover);box-shadow:0 0 0 4px rgba(36,93,168,.1)}
.hint{color:var(--muted);font-size:12px;font-weight:500}
.check{flex-direction:row;align-items:flex-start;gap:10px;font-weight:500}
.check input{flex:0 0 auto;width:18px;height:18px;min-height:0;margin-top:2px}
.check small{display:block;margin-top:3px;color:var(--muted);font-weight:500}
.mini-note{margin-top:22px}

.alert{margin-bottom:16px;padding:13px 16px;border:1px solid;border-radius:12px}
.alert-success{border-color:#abefc6;background:#ecfdf3;color:#067647}
.alert-error{border-color:#fecdca;background:#fef3f2;color:#b42318}
.alert-warning{border-color:#fedf89;background:#fffaeb;color:#a15c00}
.alert-info{border-color:#b2ddff;background:#eff8ff;color:#175cd3}

.auth-card{width:min(520px,100%);margin:34px auto}
.auth-card h1{font-size:clamp(30px,6vw,44px)}
.success-card{width:min(720px,100%);margin:24px auto;text-align:center}
.success-icon{display:grid;place-items:center;width:70px;height:70px;margin:0 auto 18px;border-radius:50%;background:#ecfdf3;color:var(--success);font-size:34px;font-weight:900}
.code-box{width:fit-content;max-width:100%;margin:24px auto 14px;padding:18px;border:1px dashed var(--primary-hover);border-radius:14px;background:#f8fbff;font:800 22px ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.05em;overflow-wrap:anywhere}

.status-shell{display:flex;flex-direction:column;gap:22px;width:min(850px,100%);margin:auto}
.inline-form{display:flex;gap:10px}
.inline-form input{flex:1}
.status-result{text-align:center}
.status-badge{display:inline-flex;margin-bottom:16px;padding:8px 13px;border-radius:999px;font-size:13px;font-weight:800}
.status-success,.pill.success{background:#ecfdf3;color:#067647}
.status-danger,.pill.danger{background:#fef3f2;color:#b42318}
.status-warning,.pill.warning{background:#fffaeb;color:#a15c00}
.status-info,.pill.info{background:#eff8ff;color:#175cd3}
.status-neutral,.pill.neutral{background:#f2f4f7;color:#475467}
.timeline{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin-top:20px}
.timeline div{padding:14px;border-radius:12px;background:#f8fafc}
.timeline span{display:block;margin-bottom:5px;color:var(--muted);font-size:12px}
.timeline strong{font-size:14px;overflow-wrap:anywhere}

.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:18px;margin-bottom:24px}
.page-head h1{font-size:clamp(34px,5vw,42px)}
.stats-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px}
.stats-grid.stats-3{grid-template-columns:repeat(3,minmax(0,1fr))}
.stat span{display:block;margin-bottom:8px;color:var(--muted);font-size:13px}
.stat strong{display:block;font-size:clamp(22px,3vw,27px);letter-spacing:-.03em;overflow-wrap:anywhere}
.card-head{display:flex;align-items:center;justify-content:space-between;gap:16px}
.list{display:flex;flex-direction:column}
.list-item{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 0;border-top:1px solid var(--line);color:var(--text)}
.list-item:first-child{border-top:0}
.list-item span{display:block}
.list-item div span{color:var(--muted);font-size:13px}
.pill{display:inline-flex;align-items:center;padding:5px 9px;border-radius:999px;font-size:12px;font-weight:800;white-space:nowrap}
.program-state{display:flex;align-items:flex-start;gap:12px;padding:18px 0}
.program-state .status-dot{margin-top:7px}
.filter-bar{display:grid;grid-template-columns:minmax(0,1fr) 250px auto;gap:12px;margin-bottom:18px;padding:16px}

.table-wrap{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
table{width:100%;min-width:720px;border-collapse:collapse}
th,td{padding:14px 13px;border-bottom:1px solid var(--line);vertical-align:middle;text-align:left}
th{color:var(--muted);font-size:12px;letter-spacing:.06em;text-transform:uppercase}
td{font-size:14px}
tr:last-child td{border-bottom:0}
.empty-cell{padding:35px;text-align:center;color:var(--muted)}
code{padding:3px 6px;border-radius:7px;background:#f2f4f7;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;overflow-wrap:anywhere}

.detail-grid{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(280px,.75fr);gap:22px;align-items:start}
.details{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin:0}
.details div{min-width:0;padding:13px;border-radius:11px;background:#f8fafc}
.details dt{margin-bottom:5px;color:var(--muted);font-size:12px}
.details dd{margin:0;font-weight:700;overflow-wrap:anywhere}
.sticky-card{position:sticky;top:94px}
.month-picker{display:flex;gap:9px}
.month-picker input{width:auto}
.bulk-card{display:flex;align-items:center;justify-content:space-between;gap:20px;margin:20px 0}
.switch-row{padding:14px;border:1px solid var(--line);border-radius:12px}
.empty-state{padding:50px 25px;text-align:center}

@media (max-width:900px){
  .hero,.form-shell,.detail-grid{grid-template-columns:1fr}
  .grid-3,.stats-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .sticky-card{position:static}
  .hero{padding-top:10px}
}

@media (max-width:680px){
  .container{width:min(100% - 24px,1160px)}
  .topbar-inner{display:block;padding:11px 0 8px}
  .brand{width:100%;padding:0 2px 9px}
  .brand-mark{width:42px;height:34px}
  .brand-text{font-size:15px}
  .nav{
    display:flex;
    flex-wrap:nowrap;
    gap:6px;
    width:calc(100% + 12px);
    margin:0 -6px;
    padding:0 6px 3px;
    overflow-x:auto;
    scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
  }
  .nav::-webkit-scrollbar{display:none}
  .nav a{min-height:38px;padding:7px 10px;background:#f8fafc;font-size:13px}
  .page{padding:26px 0 54px}
  h1{font-size:clamp(32px,10vw,40px)}
  h2{font-size:23px}
  .lead{font-size:17px}
  .card{padding:18px;border-radius:16px}
  .grid-3,.grid-2,.stats-grid,.stats-grid.stats-3,.timeline,.details{grid-template-columns:1fr}
  .filter-bar{grid-template-columns:1fr}
  .page-head,.bulk-card{align-items:stretch;flex-direction:column}
  .page-head .btn,.bulk-card .btn,.filter-bar .btn{width:100%}
  .inline-form,.month-picker{flex-direction:column}
  .inline-form .btn,.month-picker .btn{width:100%}
  .month-picker input{width:100%}
  .actions{flex-direction:column}
  .actions .btn{width:100%}
  .list-item{align-items:flex-start;flex-direction:column}
  .card-head{align-items:flex-start;flex-direction:column}
  .code-box{font-size:17px;padding:14px}
  .auth-card{margin:8px auto}
  .success-card{margin:8px auto}
  table{min-width:660px}
}

@media (max-width:380px){
  .container{width:min(100% - 18px,1160px)}
  .card{padding:15px}
  .brand-text{max-width:235px}
}
