:root {
  --navy:#16224D; --accent:#3B6FE0; --accent-soft:#E6EDFC; --accent-line:#C9D7F8;
  --bg:#F4F6FA; --surface:#FFFFFF; --border:#E3E8F0; --text:#2B3445; --muted:#6B7385;
  --good:#16803C; --good-bg:#E3F4E8; --bad:#C5221F; --bad-bg:#FCE8E6; --warn:#946200; --warn-bg:#FFF4DB;
  --radius:14px;
}
* { box-sizing:border-box; }
html { scroll-behavior:smooth; scroll-padding-top:80px; }
body { margin:0; font-family:Inter, system-ui, sans-serif; background:var(--bg); color:var(--text);
       font-size:14px; line-height:1.5; }
a { color:var(--accent); font-weight:500; text-decoration:none; }
a:hover { text-decoration:underline; }
.container { max-width:980px; margin:0 auto; padding:0 16px; }

/* ---------- top bar ---------- */
.topbar { position:sticky; top:0; z-index:10; background:rgba(255,255,255,.92); backdrop-filter:blur(8px);
          border-bottom:1px solid var(--border); }
.topbar .container { display:flex; align-items:center; justify-content:space-between; gap:16px; height:60px; }
.brand { text-decoration:none !important; display:flex; align-items:center; gap:10px; font-weight:700; color:var(--navy); font-size:16px; }
.logo { width:30px; height:30px; border-radius:8px; background:var(--accent); color:#fff;
        display:grid; place-items:center; font-size:15px; }
nav { display:flex; gap:4px; align-items:center; }
nav a { color:var(--muted); padding:7px 11px; border-radius:8px; font-size:13px; }
nav a:hover { background:var(--accent-soft); color:var(--accent); text-decoration:none; }
nav .logout { color:var(--text); border:1px solid var(--border); margin-left:6px; }
@media (max-width:720px) { nav a:not(.logout) { display:none; } }

main { padding:28px 0 60px; display:grid; gap:28px; }
.page-head h1 { margin:0; font-size:26px; color:var(--navy); letter-spacing:-.01em; }
.page-head p { margin:6px 0 0; color:var(--muted); }

/* ---------- cards ---------- */
.card { background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); }
.card-head { padding:18px 24px; border-bottom:1px solid var(--border); display:flex;
             justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.card-head h2 { margin:0; font-size:16px; color:var(--navy); }
.card-head p { margin:2px 0 0; color:var(--muted); font-size:13px; }
.card-body { padding:24px; }

/* ---------- status strip ---------- */
.status { display:grid; grid-template-columns:repeat(4, 1fr); }
.status-item { padding:16px 20px; display:flex; gap:12px; align-items:flex-start; min-width:0; }
.status-item + .status-item { border-left:1px solid var(--border); }
.dot { flex:none; width:22px; height:22px; border-radius:50%; display:grid; place-items:center;
       font-size:12px; font-weight:700; margin-top:1px; }
.dot.ok { background:var(--good-bg); color:var(--good); }
.dot.todo { background:var(--bad-bg); color:var(--bad); }
.dot.warn { background:var(--warn-bg); color:var(--warn); }
.status-item b { display:block; color:var(--navy); font-size:13px; }
.status-item span { display:block; color:var(--muted); font-size:12px; overflow-wrap:anywhere; }
.status-item .btn { margin-top:8px; }
@media (max-width:820px) {
  .status { grid-template-columns:1fr 1fr; }
  .status-item:nth-child(3) { border-left:0; }
  .status-item:nth-child(n+3) { border-top:1px solid var(--border); }
}
@media (max-width:480px) {
  .status { grid-template-columns:1fr; }
  .status-item + .status-item { border-left:0; border-top:1px solid var(--border); }
}
.help { margin:0; padding:14px 24px; background:var(--warn-bg); color:#5C4300; font-size:13px;
        border-top:1px solid var(--border); border-radius:0 0 var(--radius) var(--radius); }
.help code { background:rgba(255,255,255,.7); }

/* ---------- form ---------- */
.step { display:grid; grid-template-columns:36px 1fr; gap:16px; }
.step + .step { margin-top:28px; padding-top:28px; border-top:1px dashed var(--border); }
.step-no { width:32px; height:32px; border-radius:50%; background:var(--accent-soft); color:var(--accent);
           display:grid; place-items:center; font-weight:700; font-size:14px; }
.step h3 { margin:4px 0 2px; font-size:15px; color:var(--navy); }
.step .sub { margin:0 0 16px; color:var(--muted); font-size:13px; }
.fields { display:grid; grid-template-columns:1fr 1fr; gap:16px 20px; }
@media (max-width:640px) { .fields { grid-template-columns:1fr; } .step { grid-template-columns:1fr; gap:8px; } }
.field { display:flex; flex-direction:column; gap:6px; min-width:0; }
.field label { font-size:13px; font-weight:600; color:var(--navy); }
.field label .opt { font-weight:400; color:var(--muted); }
.field small { color:var(--muted); font-size:12px; }
input[type=text], input[type=password], input[type=date] { width:100%; padding:10px 12px; border:1px solid var(--border);
  border-radius:8px; font:inherit; color:var(--text); background:#fff; }
input::placeholder { color:#A3AAB8; }
input:focus { outline:3px solid var(--accent-soft); border-color:var(--accent); }
.presets { display:flex; gap:8px; flex-wrap:wrap; margin-bottom:14px; }
.chip { border:1px solid var(--border); background:#fff; color:var(--text); border-radius:99px;
        padding:6px 12px; font:inherit; font-size:12px; font-weight:500; cursor:pointer; }
.chip:hover, .chip.active { border-color:var(--accent); color:var(--accent); background:var(--accent-soft); }
details.optional { border:1px solid var(--border); border-radius:10px; }
details.optional summary { cursor:pointer; padding:12px 16px; font-weight:600; color:var(--navy);
                           list-style:none; display:flex; justify-content:space-between; gap:12px; }
details.optional summary::-webkit-details-marker { display:none; }
details.optional summary::after { content:"＋"; color:var(--accent); }
details.optional[open] summary::after { content:"－"; }
details.optional summary small { font-weight:400; color:var(--muted); }
details.optional .inner { padding:4px 16px 18px; display:grid; gap:16px; }
.form-foot { margin-top:28px; padding-top:20px; border-top:1px solid var(--border);
             display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap; }
.check { display:flex; align-items:center; gap:8px; color:var(--text); font-size:13px; }
.check input { width:16px; height:16px; accent-color:var(--accent); }

/* ---------- buttons ---------- */
.btn { display:inline-flex; align-items:center; gap:6px; border:0; border-radius:8px; padding:10px 18px;
       font:inherit; font-size:14px; font-weight:600; cursor:pointer; background:var(--accent); color:#fff; }
.btn:hover { filter:brightness(1.05); text-decoration:none; }
.btn:disabled { background:#B8C3D9; cursor:not-allowed; }
.btn.sm { padding:6px 12px; font-size:12px; }
.btn.ghost { background:#fff; color:var(--text); border:1px solid var(--border); }
.btn.soft { background:var(--accent-soft); color:var(--accent); }
.btn.danger { background:#fff; color:var(--bad); border:1px solid var(--border); }

/* ---------- lists ---------- */
.list { display:grid; }
.row { display:grid; grid-template-columns:minmax(0,1.4fr) minmax(0,1fr) auto; gap:16px; align-items:center;
       padding:16px 24px; }
.row + .row { border-top:1px solid var(--border); }
.row .title { font-weight:600; color:var(--navy); }
.row .meta { color:var(--muted); font-size:12px; overflow-wrap:anywhere; }
.row .links { display:flex; gap:8px; flex-wrap:wrap; }
.row .error { color:var(--bad); font-size:12px; grid-column:1/-1; overflow-wrap:anywhere; }
.row .warns { color:var(--warn); font-size:12px; grid-column:1/-1; }
.actions { display:flex; gap:8px; justify-content:flex-end; flex-wrap:wrap; }
@media (max-width:720px) { .row { grid-template-columns:1fr; } .actions { justify-content:flex-start; } }
.badge { display:inline-block; padding:3px 10px; border-radius:99px; font-size:11px; font-weight:600;
         background:var(--accent-soft); color:var(--accent); text-transform:capitalize; white-space:nowrap; }
.badge.done { background:var(--good-bg); color:var(--good); }
.badge.failed { background:var(--bad-bg); color:var(--bad); }
.badge.off { background:#EEF0F3; color:var(--muted); }
.empty { padding:36px 24px; text-align:center; color:var(--muted); }
.flash { background:var(--accent-soft); border:1px solid var(--accent-line); color:var(--navy);
         padding:12px 16px; border-radius:10px; font-weight:500; }
code { background:var(--bg); padding:1px 6px; border-radius:5px; font-size:12px; }

/* ---------- guide ---------- */
.guide { display:grid; grid-template-columns:repeat(auto-fit, minmax(280px, 1fr)); gap:16px; }
.term { border:1px solid var(--border); border-radius:12px; padding:18px 20px; background:#fff; }
.term h3 { margin:0 0 4px; font-size:15px; color:var(--navy); display:flex; align-items:center;
           gap:6px 8px; flex-wrap:wrap; }
.tag { font-size:10px; font-weight:700; letter-spacing:.04em; padding:2px 7px; border-radius:99px;
       background:var(--bad-bg); color:var(--bad); }
.tag.opt { background:#EEF0F3; color:var(--muted); }
.term p { margin:6px 0; color:var(--text); font-size:13px; }
.term .label { display:block; margin-top:10px; font-size:11px; font-weight:700; letter-spacing:.04em;
               color:var(--muted); text-transform:uppercase; }
.term ul { margin:4px 0 0; padding-left:18px; font-size:13px; }
.term li { margin:2px 0; }
.example { margin-top:8px; background:var(--bg); border-radius:8px; padding:8px 10px; font-size:12px;
           font-family:ui-monospace, SFMono-Regular, Consolas, monospace; color:var(--navy); overflow-wrap:anywhere; }
.guide-note { margin-top:16px; color:var(--muted); font-size:13px; }

/* ---------- validation ---------- */
.field.invalid input { border-color:var(--bad); background:#FFFBFB; }
.field .err { color:var(--bad); font-size:12px; font-weight:500; }
.form-error { background:var(--bad-bg); color:var(--bad); border-radius:10px; padding:12px 16px; font-weight:500; margin-bottom:20px; }
.flash.error { background:var(--bad-bg); border-color:#F3C5C0; color:var(--bad); }
.flash.success { background:var(--good-bg); border-color:#BFE3CB; color:var(--good); }
.inline-form { display:inline; margin:0; }
nav button.logout { font:inherit; font-size:13px; background:#fff; cursor:pointer; padding:7px 11px; border-radius:8px; }
.switch { display:flex; align-items:center; gap:8px; }
.back { display:inline-flex; gap:6px; align-items:center; color:var(--muted); font-size:13px; margin-bottom:6px; }

/* ---------- login ---------- */
.login-wrap { min-height:100vh; display:grid; place-items:center; padding:16px; }
.login-card { width:100%; max-width:380px; background:#fff; border:1px solid var(--border);
              border-top:4px solid var(--accent); border-radius:12px; padding:28px; display:grid; gap:14px; }
.login-card h1 { margin:0; font-size:22px; color:var(--navy); }
.login-card p { margin:-8px 0 6px; color:var(--muted); font-size:13px; }
.login-card .btn { width:100%; justify-content:center; padding:11px; }


/* ---------- period picker ---------- */
.chip[aria-pressed="true"] { border-color:var(--accent); color:var(--accent); background:var(--accent-soft); }
.period-summary { margin:0 0 12px; font-size:13px; color:var(--muted); }
.period-summary b { color:var(--navy); font-weight:600; }
.period-note { display:block; margin-top:10px; color:var(--muted); font-size:12px; }
.period-picker .fields[hidden] { display:none; }

/* ---------- report jobs ---------- */
.jobs { list-style:none; margin:0; padding:0; }
.job { padding:16px 24px; }
.job + .job { border-top:1px solid var(--border); }
.job-main { display:flex; align-items:center; gap:14px; min-width:0; }
.job-icon { flex:none; width:32px; height:32px; border-radius:50%; display:grid; place-items:center;
            font-weight:700; font-size:14px; background:var(--accent-soft); color:var(--accent); }
.job-done .job-icon { background:var(--good-bg); color:var(--good); }
.job-failed .job-icon { background:var(--bad-bg); color:var(--bad); }
.job-text { flex:1; min-width:0; }
.job-text .title { font-weight:600; color:var(--navy); }
.job-text .meta { color:var(--muted); font-size:12px; overflow-wrap:anywhere; }
.job-side { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.spinner { width:14px; height:14px; border-radius:50%; border:2px solid var(--accent-line);
           border-top-color:var(--accent); animation:spin .9s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

.job-progress { margin:12px 0 0 46px; }
.job-progress .bar { height:4px; border-radius:99px; background:var(--accent-soft); overflow:hidden; }
.job-progress .bar span { display:block; height:100%; width:35%; border-radius:99px; background:var(--accent);
                          animation:slide 1.6s ease-in-out infinite; }
@keyframes slide { 0% { transform:translateX(-100%); } 100% { transform:translateX(300%); } }
.job-progress small { display:block; margin-top:6px; color:var(--muted); font-size:12px; }

.job-error { margin:12px 0 0 46px; display:flex; gap:16px; align-items:flex-start; justify-content:space-between;
             background:#FFF7F6; border:1px solid #F6D4D0; border-left:3px solid var(--bad);
             border-radius:10px; padding:12px 14px; }
.job-error-text { min-width:0; }
.job-error b { color:var(--bad); font-size:13px; }
.job-error p { margin:3px 0 6px; font-size:13px; color:var(--text); }
.job-error details summary { cursor:pointer; font-size:12px; color:var(--muted); }
.job-error code { display:block; margin-top:6px; padding:8px 10px; max-height:120px; overflow:auto;
                  background:#fff; border:1px solid var(--border); border-radius:6px;
                  font-size:11px; line-height:1.5; white-space:pre-wrap; overflow-wrap:anywhere; color:var(--muted); }
.job-error form { flex:none; }
.job-warnings { margin:10px 0 0 46px; font-size:12px; color:var(--warn); }
.job-warnings summary { cursor:pointer; font-weight:500; }
.job-warnings ul { margin:6px 0 0; padding-left:18px; color:var(--text); }
.job-warnings li { margin:3px 0; }
@media (max-width:640px) {
  .job-main { flex-wrap:wrap; }
  .job-side { width:100%; justify-content:flex-start; padding-left:46px; }
  .job-error { flex-direction:column; margin-left:0; }
  .job-progress, .job-warnings { margin-left:0; }
}

/* ---------- dialog ---------- */
dialog { border:0; border-radius:14px; padding:0; width:min(520px, calc(100vw - 32px));
         box-shadow:0 24px 60px rgba(22,34,77,.25); color:var(--text); }
dialog::backdrop { background:rgba(22,34,77,.35); }
dialog form { padding:22px 24px; }
.dialog-head { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.dialog-head h2 { margin:0; font-size:17px; color:var(--navy); }
dialog .sub { margin:4px 0 16px; color:var(--muted); font-size:13px; }
.icon-btn { border:0; background:transparent; font-size:24px; line-height:1; color:var(--muted); cursor:pointer;
            width:32px; height:32px; border-radius:8px; }
.icon-btn:hover { background:var(--bg); color:var(--text); }
.dialog-foot { display:flex; justify-content:flex-end; gap:10px; margin-top:20px; padding-top:16px;
               border-top:1px solid var(--border); }
