:root{
  --green:#385a47;--dark:#183126;--line:#d7e0da;--soft:#f2f6f3;
  --red:#c94a43;--gold:#bd8a2e;--bg:#f4f7f5;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--bg);color:#17231c;font-family:Pretendard,"Noto Sans KR",sans-serif}
button,input,select{font:inherit}
button{border:1px solid var(--line);border-radius:12px;padding:11px 16px;background:#eef3ef;font-weight:700;cursor:pointer}
.primary{background:var(--dark);color:#fff}
.hidden{display:none!important}

/* 전용 로딩 화면 */
.loading{
  position:fixed;inset:0;z-index:9999;display:grid;place-items:center;
  background:linear-gradient(145deg,#f8fbf9 0%,#edf4ef 55%,#e3eee7 100%);
  padding:24px;
}
.loading-panel{
  width:min(360px,88vw);text-align:center;padding:38px 28px 34px;
  background:rgba(255,255,255,.92);border:1px solid rgba(56,90,71,.12);
  border-radius:28px;box-shadow:0 24px 70px rgba(24,49,38,.14);
}
.loading-mark{
  width:66px;height:66px;margin:0 auto 22px;display:grid;place-items:center;
  border-radius:20px;background:var(--green);color:#fff;font-size:30px;font-weight:800;
  box-shadow:0 12px 28px rgba(56,90,71,.24);
}
.loading-spinner{
  width:42px;height:42px;margin:0 auto 20px;border:4px solid #dfe9e3;
  border-top-color:var(--green);border-radius:50%;animation:spin .8s linear infinite;
}
.loading-panel strong{display:block;font-size:22px;color:var(--dark);margin-bottom:9px}
.loading-panel p{margin:0 0 7px;font-size:15px;font-weight:700;color:#53665b}
.loading-panel small{color:#8a9990}
@keyframes spin{to{transform:rotate(360deg)}}

.topbar{
  position:sticky;top:0;z-index:10;display:flex;justify-content:space-between;
  align-items:center;padding:10px 4%;background:#fff;border-bottom:1px solid var(--line)
}
.brand{display:flex;gap:12px;align-items:center;min-width:0}
.brand-mark{padding:9px;border-radius:11px;background:var(--green);color:#fff;font-size:21px}
.brand strong,.brand span{display:block}
.brand strong{white-space:nowrap}
.brand span{font-size:12px;color:#748078}
.top-actions{display:flex;gap:8px}
.top-actions button{padding:9px 13px}
.wrap{width:min(1800px,94%);margin:12px auto}
.hero,.step-card,.table-card{background:#fff;border:1px solid var(--line);border-radius:18px;padding:18px;margin-bottom:12px}
.hero{display:flex;justify-content:space-between;gap:30px;padding:20px;background:linear-gradient(135deg,#315a45,#496f5a);color:#fff}
.hero h1{font-size:30px;line-height:1.35;margin:5px 0}
.hero p{line-height:1.55}
.eyebrow,.kicker{font-size:12px;font-weight:800;letter-spacing:2px}
.week-box{min-width:300px;padding:20px;border-radius:18px;background:#fff;color:#222}
.week-box input{width:100%;padding:12px;margin:10px 0;border:1px solid var(--line);border-radius:10px}
.week-buttons{display:flex;gap:8px}.week-buttons button{flex:1}
.step-head{display:flex;gap:10px;align-items:center}
.step-head>span{display:grid;place-items:center;width:36px;height:36px;flex:0 0 36px;border-radius:50%;background:var(--green);color:#fff;font-weight:800}
.step-head h2{margin:0;font-size:24px}.step-head p{margin:5px 0 0;font-size:14px;color:#69786f}
.staff-form{display:grid;grid-template-columns:2fr 1fr 1fr 1fr 1fr auto auto;gap:8px;margin:12px 0;align-items:end}
.staff-form label{font-size:12px;font-weight:700}
.staff-form input,.staff-form select,.schedule-table input,.schedule-table select{width:100%;border:1px solid var(--line);border-radius:9px}
.staff-form input,.staff-form select{height:38px;padding:6px 10px;font-size:14px}
.staff-form button{height:38px;padding:0 13px;font-size:13px;white-space:nowrap}
.matrix-scroll,.table-scroll{overflow:auto;-webkit-overflow-scrolling:touch}
table{width:100%;border-collapse:collapse}
th,td{border:1px solid var(--line);padding:10px;text-align:center}
th{background:#edf3ef}
.staff-table th{position:sticky;top:0;z-index:2;padding:8px 7px;font-size:14px}
.staff-table td{padding:6px 7px;font-size:14px;line-height:1.25}
.staff-list-scroll{max-height:390px;overflow-y:auto;border-bottom:1px solid var(--line)}
.toolbar,.table-head,.final-actions{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:10px 0}
.legend i{display:inline-block;width:14px;height:14px;background:var(--red);border-radius:4px}
.dayoff-scroll{max-height:500px;overflow-y:auto}
.dayoff-table thead th{position:sticky;top:0;z-index:2}
.dayoff-table th,.dayoff-table td{padding:5px 6px;font-size:13px}
.day-toggle{padding:6px 8px;border-radius:8px;font-size:12px}
.day-toggle.off{background:var(--red);color:#fff}
.required-actions{display:flex;justify-content:flex-end;gap:8px;margin:7px 0}
.required-grid{display:grid;grid-template-columns:repeat(7,1fr);gap:6px}
.required-day{padding:9px;background:var(--soft);border-radius:12px;font-size:13px}
.required-day label{display:block;margin-top:8px}
.required-day input{width:62px}
.required-day input:disabled{border:0;background:transparent;color:#111;font-weight:800;opacity:1}
.generate-box{text-align:center;margin-top:12px}.generate-box p{margin:7px 0 0;font-size:13px}.big{font-size:17px}
.table-card{padding:14px 8px}
.table-head{margin:8px 0 12px}
.schedule-table{width:100%;min-width:0;table-layout:fixed;font-size:10px;border:2px solid #555}
.schedule-table th,.schedule-table td{height:34px;padding:3px 4px;border:1px solid #777}
.schedule-table th:first-child,.schedule-table td:first-child{width:6%;font-weight:800}
.schedule-table th:not(:first-child),.schedule-table td:not(:first-child){max-width:6.72%}
.schedule-table th{background:#ffc20e;color:#111}
.schedule-table select,.schedule-table .work-time{min-width:0;width:100%;height:28px;padding:1px;border:0;border-radius:0;background:transparent;text-align:center;font-size:10px;font-weight:600}
.schedule-table select:focus,.schedule-table .work-time:focus{outline:2px solid var(--green);background:#fff}
.section-band td{height:30px;background:#8bd048!important;color:#111;text-align:left;font-size:14px;font-weight:900}
.wash-band td{background:#cfdff1!important}
.total-row td{background:#dcefd7;font-weight:900}
.off-row td{height:auto;min-height:32px;background:#fff4df;color:#54231f;text-align:center;font-size:10px;white-space:normal;font-weight:700}
.off-names{color:#6f211d;font-size:11px;font-weight:900}
.missing-names{color:#a14a22;font-weight:800}.target-ok{color:#197044}
.schedule-table .work-time{cursor:pointer;color:#111;font-weight:800}
.status-summary{margin-top:14px;padding:16px;border:1px solid #f0d2cc;border-radius:12px;background:#fffaf8;color:#26352d;white-space:pre-line;font-size:12px}
.status-summary.status-ok{border-color:#c8e3d2;background:#eef8f2}
.validation-ok{color:#17633d;font-size:15px;font-weight:900;text-align:center}
.validation-title{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px}
.validation-title strong{font-size:16px;color:#8e2f28}.validation-title span{color:#746b67;font-size:12px}
.validation-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.validation-card{display:flex;align-items:center;justify-content:center;gap:10px;padding:12px;border-radius:14px;background:#fff}
.validation-card b{font-size:22px}.validation-card span{font-size:13px}
.missing-card{border-color:#efb37e;color:#9a430c;background:#fff7ed}
.off-card{border-color:#e1aaa5;color:#8e2f28;background:#fff1f0}
.duplicate-card{border-color:#b9b6e4;color:#4b4695;background:#f4f3ff}
.validation-details{margin-top:12px;padding:13px;border-radius:12px;background:#fff;border:1px solid var(--line)}
.detail-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:9px}.detail-head button{padding:5px 10px}
.detail-chips{display:flex;flex-wrap:wrap;gap:7px}.detail-chips span{padding:6px 10px;border-radius:999px;background:#f3f5f3;color:#4a554e;font-size:12px;font-weight:800}
.manage-buttons{display:flex;justify-content:center;gap:6px}.manage-buttons button{padding:6px 10px;font-size:12px;border-radius:9px}
.danger{color:#a52621}
.final-actions{margin:10px 0}
.modal{position:fixed;inset:0;z-index:50;display:grid;place-items:center;padding:20px}
.modal-backdrop{position:absolute;inset:0;background:rgba(17,35,27,.58);backdrop-filter:blur(3px)}
.modal-card{position:relative;z-index:1;width:min(540px,100%);padding:20px;border-radius:22px;background:#fff;box-shadow:0 24px 70px rgba(0,0,0,.28)}
.modal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:18px}.modal-head h2{margin:0;font-size:22px}.modal-close{padding:8px 11px;border-radius:50%}
.modal-form{display:grid;gap:10px}.modal-form label{display:grid;gap:7px;font-size:14px;font-weight:800}
.modal-form input,.modal-form select{width:100%;height:40px;padding:8px 12px;border:1px solid var(--line);border-radius:10px;background:#fff;font-size:14px}
.time-fields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:8px}.modal-actions button{height:40px;font-size:13px}
.modal-open{overflow:hidden}
footer{text-align:center;padding:30px;color:#7b8980}

/* 태블릿 */
@media(max-width:1000px){
  .hero{display:block}.week-box{min-width:0;margin-top:18px}
  .staff-form{grid-template-columns:repeat(2,1fr)}
  .required-grid{grid-template-columns:repeat(2,1fr)}
  .schedule-table{min-width:1180px;font-size:10px}
  .table-scroll{overflow-x:auto}
}

/* 휴대폰 전용 */
@media(max-width:640px){
  body{background:#f5f7f5}
  .topbar{position:static;display:block;padding:12px 14px}
  .brand-mark{width:42px;height:42px;padding:0;display:grid;place-items:center;font-size:19px}
  .brand strong{font-size:15px;white-space:normal}.brand span{font-size:10px}
  .top-actions{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px;margin-top:11px}
  .top-actions button{min-width:0;padding:9px 4px;border-radius:9px;font-size:11px;white-space:nowrap}
  .wrap{width:100%;margin:0;padding:8px}
  .hero,.step-card,.table-card{border-radius:15px;margin-bottom:9px;padding:14px}
  .hero{display:block;padding:16px}
  .hero-copy .eyebrow{margin:0 0 6px;font-size:10px}
  .hero h1{font-size:20px;line-height:1.35;margin:4px 0 8px}
  .hero h1 br{display:none}
  .hero-copy>p:last-child{font-size:12px;margin:0;line-height:1.5}
  .week-box{margin-top:14px;padding:13px;border-radius:13px}
  .week-box label{font-size:12px;font-weight:800}.week-box input{height:44px;margin:7px 0}
  .week-buttons button{height:42px;padding:0}
  .step-head{align-items:flex-start}.step-head>span{width:30px;height:30px;flex-basis:30px;font-size:13px}
  .step-head h2{font-size:18px}.step-head p{font-size:11px;line-height:1.45}
  .staff-form{grid-template-columns:1fr 1fr;gap:8px}
  .staff-form label:first-child{grid-column:1/-1}
  .staff-form input,.staff-form select{height:44px;font-size:16px}
  .staff-form button{height:43px;font-size:12px}
  .staff-list-scroll{max-height:330px;border:1px solid var(--line);border-radius:10px}
  .staff-table{min-width:650px}
  .staff-table th,.staff-table td{font-size:12px;white-space:nowrap}
  .toolbar{align-items:flex-start;flex-direction:column}
  .dayoff-actions{display:grid;grid-template-columns:1fr 1fr;width:100%;gap:7px}
  .dayoff-actions button{padding:10px 5px;font-size:12px}
  .legend{font-size:11px}
  .dayoff-scroll{max-height:440px;border:1px solid var(--line);border-radius:10px}
  .dayoff-table{min-width:720px}
  .dayoff-table th:first-child,.dayoff-table td:first-child{
    position:sticky;left:0;z-index:3;background:#fff;box-shadow:2px 0 4px rgba(0,0,0,.06)
  }
  .dayoff-table thead th:first-child{z-index:5;background:#edf3ef}
  .required-actions{justify-content:stretch}.required-actions button{flex:1;font-size:12px}
  .required-grid{grid-template-columns:1fr 1fr;gap:7px}
  .required-day{padding:10px;border:1px solid #e1e8e3}
  .required-day input{width:100%;height:38px;margin-top:3px}
  .generate-box .big{width:100%;height:48px;font-size:14px}
  .generate-box p{font-size:11px;line-height:1.45}
  .table-head{display:block}.table-head h2{font-size:18px;margin:3px 0 8px}.table-head #warningText{font-size:11px}
  .table-card{padding:12px 8px}
  .table-scroll{border:1px solid #cfd8d2;border-radius:10px;overflow-x:auto}
  .schedule-table{min-width:1120px;width:1120px;font-size:10px}
  .schedule-table th:first-child,.schedule-table td:first-child{
    position:sticky;left:0;z-index:3;width:78px;background:#fff;
    box-shadow:2px 0 4px rgba(0,0,0,.08)
  }
  .schedule-table thead th:first-child{z-index:5;background:#ffc20e}
  .section-band td:first-child,.wash-band td:first-child,.total-row td:first-child{position:static;box-shadow:none}
  .validation-title{display:block}.validation-title span{display:block;margin-top:5px}
  .validation-cards{grid-template-columns:1fr}
  .final-actions{display:grid;grid-template-columns:1fr 1fr;margin-top:12px}
  .final-actions button{height:46px;padding:0 7px;font-size:12px}
  .final-actions .primary{grid-column:1/-1}
  .time-fields{grid-template-columns:1fr 1fr}
  .modal{padding:12px}.modal-card{max-height:92vh;overflow:auto;padding:18px;border-radius:18px}
  footer{padding:18px;font-size:11px}
  .loading-panel{padding:32px 22px;border-radius:24px}
  .loading-mark{width:58px;height:58px;font-size:26px}
  .loading-panel strong{font-size:19px}
}

/* 아주 작은 휴대폰 */
@media(max-width:380px){
  .top-actions{grid-template-columns:1fr 1fr}
  .top-actions button:last-child{grid-column:1/-1}
  .staff-form{grid-template-columns:1fr}
  .staff-form label:first-child{grid-column:auto}
  .required-grid{grid-template-columns:1fr}
  .time-fields{grid-template-columns:1fr}
}

@media print{
  body{background:#fff}.loading,.topbar,.hero,.step-card,.final-actions,footer{display:none!important}
  .wrap{width:100%;margin:0}.table-card{border:0;padding:0}.table-scroll{overflow:visible}
  .schedule-table{min-width:0;width:100%;font-size:8px}.schedule-table th,.schedule-table td{height:22px;padding:1px}
  .schedule-table select,.schedule-table .work-time{font-size:8px;height:20px}.status-summary{display:none}
  @page{size:A4 landscape;margin:7mm}
}
