@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Noto+Sans+JP:wght@400;500;600;700;800&display=swap");

:root {
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
  color: #15201b;
  background: #eef1ee;
  --ink: #15201b;
  --muted: #65716a;
  --green: #176b4a;
  --green-bright: #20a36c;
  --green-pale: #e2f1e9;
  --line: #cbd2cd;
  --soft-line: #e2e7e3;
  --surface: #ffffff;
  --dark: #101815;
  --danger: #b12a2a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; background: #eef1ee; }
button, input, select { font: inherit; border-radius: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }

.shell { width: min(1180px, 100%); margin: 0 auto; padding: 34px 28px 60px; }
header { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding: 0 0 22px; margin-bottom: 22px; border-bottom: 2px solid var(--ink); }
header > div:last-child { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; font-weight: 600; }
h1 { margin: 3px 0 0; font-size: clamp(30px, 4vw, 46px); line-height: 1; letter-spacing: -.045em; }
h2 { margin: 0; font-size: 17px; line-height: 1.4; letter-spacing: -.02em; }
.eyebrow { display: block; color: var(--green); font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.muted { color: var(--muted); margin: 5px 0 0; font-size: 13px; line-height: 1.7; }
.error { color: var(--danger) !important; }

.panel { position: relative; margin-bottom: 18px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--ink); }
.panel > h2 + .muted { margin-bottom: 18px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid .panel { margin-bottom: 18px; }

.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-top: 3px solid var(--green); margin-bottom: 18px; background: var(--surface); }
.summary-card { min-height: 112px; padding: 20px 22px; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; border-right: 1px solid var(--soft-line); }
.summary-card:last-child { border-right: 0; }
.summary-card > span { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.summary-card strong { font-size: 28px; letter-spacing: -.04em; }
.run-status { display: flex; align-items: center; gap: 10px; min-height: 34px; }

form { display: grid; gap: 13px; }
label { display: grid; gap: 7px; color: #36413b; font-size: 12px; font-weight: 700; }
input, select { width: 100%; min-height: 45px; padding: 10px 12px; color: var(--ink); background: #fbfcfb; border: 1px solid #aeb8b1; transition: border-color .15s, box-shadow .15s, background .15s; }
input:hover, select:hover { border-color: #748078; }
input:focus, select:focus { outline: 0; border-color: var(--green); background: #fff; box-shadow: inset 3px 0 0 var(--green); }

button { min-height: 43px; padding: 10px 16px; color: #fff; background: var(--green); border: 1px solid var(--green); font-size: 13px; font-weight: 800; letter-spacing: .01em; transition: background .15s, border-color .15s, color .15s, transform .1s; }
button:hover:not(:disabled) { background: #0e563a; border-color: #0e563a; }
button:active:not(:disabled) { transform: translateY(1px); }
.ghost { margin-left: 0; color: var(--ink); background: #fff; border-color: #9ca79f; }
.ghost:hover:not(:disabled) { color: var(--green); background: var(--green-pale); border-color: var(--green); }
.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.danger:hover:not(:disabled) { background: #8f2020; border-color: #8f2020; }

.three { grid-template-columns: repeat(3, 1fr); }
.three button { grid-column: 1 / -1; }
.compact { grid-template-columns: repeat(3, 1fr); }
.compact button { grid-column: 1 / -1; }
.two-settings { grid-template-columns: 1fr 1fr; }
.two-settings button { grid-column: 1 / -1; }
.actions, .form-actions, .user-actions { display: flex; gap: 8px; }
.form-actions button { flex: 1; }
.run-actions { margin: 20px 0 12px; }
.run-actions #bulkStart { min-width: 280px; }

.mini-list, .profiles, .user-list { display: grid; gap: 0; margin-top: 18px; border-top: 1px solid var(--line); }
.mini-list { max-height: 300px; overflow-y: auto; overscroll-behavior: contain; border-bottom: 1px solid var(--line); }
.profiles { max-height: 480px; overflow-y: auto; overscroll-behavior: contain; }
.user-list { max-height: 560px; overflow-y: auto; overscroll-behavior: contain; }
.mini-list::-webkit-scrollbar, .profiles::-webkit-scrollbar, .user-list::-webkit-scrollbar { width: 8px; }
.mini-list::-webkit-scrollbar-track, .profiles::-webkit-scrollbar-track, .user-list::-webkit-scrollbar-track { background: #edf1ee; }
.mini-list::-webkit-scrollbar-thumb, .profiles::-webkit-scrollbar-thumb, .user-list::-webkit-scrollbar-thumb { background: #89958d; }
.mini-row, .profile, .user { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 4px; background: #fff; border: 0; border-bottom: 1px solid var(--soft-line); }
.mini-row > b, .profile b, .user b { font-size: 13px; }
.mini-row small, .profile small { display: block; max-width: 560px; margin-top: 3px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; overflow-wrap: anywhere; }
.mini-row .ghost, .user-actions button, .profile button { min-height: 34px; padding: 7px 11px; font-size: 11px; }
.empty { padding: 34px 16px; color: #7c8881; background: #f6f8f6; border-bottom: 1px solid var(--line); text-align: center; font-size: 13px; }

.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 18px 0; border: 1px solid #aeb8b1; }
.mode-card { display: flex; grid-template-columns: none; align-items: flex-start; gap: 11px; min-height: 88px; padding: 17px; border: 0; border-right: 1px solid #aeb8b1; cursor: pointer; transition: background .15s; }
.mode-card:last-child { border-right: 0; }
.mode-card:has(input:checked) { background: var(--green-pale); box-shadow: inset 4px 0 0 var(--green); }
.mode-card input { width: auto; min-height: 0; margin: 3px 0 0; padding: 0; accent-color: var(--green); box-shadow: none; }
.mode-card span { display: grid; gap: 5px; }
.mode-card b { font-size: 14px; }
.mode-card small { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.6; }
.preview-controls { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin: 16px 0; }
details { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
summary { color: var(--green); cursor: pointer; font-size: 13px; font-weight: 800; }
.check-label { display: flex; align-items: center; gap: 8px; }
.check-label input { width: auto; min-height: 0; margin: 0; padding: 0; }

.spinner { width: 20px; height: 20px; flex: 0 0 20px; border: 2px solid #c7d3cb; border-top-color: var(--green); border-radius: 50%; animation: spin .7s linear infinite; }
.spinner[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Login */
.login-page { display: grid; place-items: center; padding: 28px; background: #dfe5e1; }
.login-shell { width: min(1040px, 100%); min-height: 620px; display: grid; grid-template-columns: 1.08fr .92fr; background: #fff; border: 1px solid #9fa9a2; box-shadow: 18px 18px 0 #bdc8c0; }
.login-brand { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 620px; padding: 48px; color: #fff; background: var(--dark); overflow: hidden; }
.login-brand::before { content: ""; position: absolute; inset: 0; opacity: .16; background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px); background-size: 44px 44px; }
.login-brand::after { content: "AM"; position: absolute; right: -24px; bottom: -54px; color: #fff; opacity: .045; font-size: 260px; font-weight: 800; line-height: 1; letter-spacing: -.12em; }
.login-brand > * { position: relative; z-index: 1; }
.login-brand .eyebrow { color: #73d9aa; }
.brand-lockup { display: flex; align-items: center; gap: 14px; }
.login-mark { width: 48px; height: 48px; display: grid; place-items: center; color: #fff; background: var(--green-bright); font-size: 24px; font-weight: 800; }
.login-brand h1 { max-width: 450px; margin-top: 20px; font-size: clamp(42px, 6vw, 72px); line-height: .98; }
.login-brand p { max-width: 440px; color: #aebbb4; font-size: 13px; line-height: 1.9; }
.login-card { display: flex; flex-direction: column; justify-content: center; padding: 54px; background: #fff; border: 0; border-top: 0; margin: 0; }
.login-card h2 { margin-top: 14px; font-size: 30px; }
.login-card form { margin-top: 32px; text-align: left; }
.login-card button { margin-top: 8px; }
.login-note { margin-top: 28px; color: #7c8881; font-size: 11px; line-height: 1.7; }

@media (max-width: 760px) {
  .shell { padding: 22px 14px 44px; }
  header { align-items: flex-start; flex-direction: column; }
  h1 { font-size: 34px; }
  .grid, .three, .compact, .two-settings, .summary-grid, .mode-grid, .preview-controls { grid-template-columns: 1fr; }
  .summary-card { min-height: 90px; border-right: 0; border-bottom: 1px solid var(--soft-line); }
  .summary-card:last-child { border-bottom: 0; }
  .mode-card { border-right: 0; border-bottom: 1px solid #aeb8b1; }
  .mode-card:last-child { border-bottom: 0; }
  .mini-row, .profile, .user { align-items: flex-start; flex-direction: column; }
  .user-actions, .form-actions, .run-actions { width: 100%; flex-wrap: wrap; }
  .user-actions button, .form-actions button, .run-actions button { flex: 1; }
  .run-actions #bulkStart { min-width: 0; }
  .login-page { padding: 14px; }
  .login-shell { display: block; min-height: 0; box-shadow: 8px 8px 0 #bdc8c0; }
  .login-brand { min-height: 230px; padding: 28px; }
  .login-brand h1 { font-size: 40px; }
  .login-brand p { margin-bottom: 0; }
  .login-card { padding: 34px 28px; }
}
