:root { font-family:"Yu Gothic UI","Meiryo",sans-serif; color:#4c3929; background:#fff7dc; }
* { box-sizing:border-box; }
body { margin:0; background:#fffdf8; }
button, input, textarea { font:inherit; }
button, .back-link { min-height:40px; padding:8px 13px; border:1px solid #957e63; border-radius:8px; color:#5c4736; background:#fffdf8; font-weight:700; text-decoration:none; cursor:pointer; }
button:hover, .back-link:hover { background:#fff0dc; }
button.primary { color:#fff; background:#957e63; }
.auth-panel { width:min(440px,calc(100% - 32px)); margin:12vh auto; padding:28px; border:1px solid #e4be8a; border-radius:14px; background:#fffdf8; box-shadow:0 10px 32px #6d4e3826; }
.auth-panel h1 { margin-top:0; font-size:22px; }
.auth-panel form, .password-form { display:grid; gap:14px; }
label { display:grid; gap:7px; font-weight:700; }
input[type="text"], input[type="password"], input[type="month"], input[type="date"] { width:100%; min-height:40px; padding:8px 10px; border:1px solid #d7a76e; border-radius:7px; background:#fffdf8; }
.error { min-height:1.5em; margin:0; color:#a23427; }
.admin-app { width:min(1160px,calc(100% - 32px)); margin:0 auto; padding:30px 0 52px; }
header { display:flex; align-items:start; justify-content:space-between; gap:20px; margin-bottom:20px; }
header h1 { margin:0 0 8px; font-size:clamp(23px,4vw,32px); }
header p, .hint { color:#705846; line-height:1.7; }
.back-link { flex:0 0 auto; }
.notice { display:grid; gap:5px; margin-bottom:18px; padding:14px 16px; border-left:4px solid #d9963c; background:#fff3d7; line-height:1.6; }
.layout { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(300px,.75fr); gap:18px; }
.panel { margin-top:18px; padding:22px; border:1px solid #e4be8a; border-radius:14px; background:#fffdf8; box-shadow:0 4px 14px #6d4e3812; }
.layout .panel { margin-top:0; }
.panel h2 { margin:0 0 12px; font-size:22px; }
.panel h3 { margin:26px 0 5px; font-size:17px; }
.toggle { display:flex; grid-template-columns:auto 1fr; align-items:center; gap:9px; }
.toggle input { width:18px; height:18px; }
.key-list { display:grid; gap:10px; margin:12px 0; }
.key-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)) auto auto; gap:8px; align-items:end; padding:12px; border:1px solid #ead9c8; border-radius:9px; background:#fffaf4; }
.key-row.period { grid-template-columns:1.2fr 1fr 1fr 1fr auto auto; }
.key-row button { min-height:38px; padding:6px 9px; }
.actions { display:flex; flex-wrap:wrap; gap:9px; margin-top:22px; }
.status { min-height:1.6em; margin:12px 0 0; color:#176b3a; line-height:1.6; }
textarea { width:100%; resize:vertical; padding:12px; border:1px solid #d7a76e; border-radius:8px; background:#fffaf4; color:#4c3929; line-height:1.45; }
.password-panel { max-width:720px; }
.shared-settings-panel { max-width:920px; }
.settings-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.terms-page { width:min(860px,calc(100% - 32px)); margin:0 auto; padding:30px 0 50px; line-height:1.75; }
.terms-page h1 { margin:0 0 22px; font-size:clamp(25px,4vw,34px); }
.terms-page section { margin:18px 0; padding:18px 20px; border:1px solid #e4be8a; border-radius:12px; background:#fffdf8; box-shadow:0 4px 14px #6d4e3812; }
.terms-page h2 { margin:0 0 8px; font-size:19px; }
.terms-page p { margin:9px 0; }
.back-button { margin:0 0 10px; }
code { overflow-wrap:anywhere; }
@media (max-width:800px) { .layout { grid-template-columns:1fr; } header { flex-direction:column; } .key-row, .key-row.period, .settings-grid { grid-template-columns:1fr 1fr; } .key-row button { width:100%; } }
@media (max-width:540px) { .settings-grid { grid-template-columns:1fr; } .terms-page { width:min(100% - 24px,860px); padding-top:20px; } .terms-page section { padding:15px; } }

/* 旧自動型紙作成アプリの作図プログラム管理画面 */
.program-admin-layout { display:grid; grid-template-columns:minmax(0,640px) minmax(280px,1fr); gap:18px; }
.program-admin-layout .panel { margin-top:0; padding:18px; border-color:#efb35f; border-radius:8px; }
.program-admin-layout .panel h2 { font-size:16px; }
.program-admin-layout .panel h3 { margin:20px 0 6px; font-size:15px; }
.program-list { display:grid; gap:12px; }
.program-item { display:grid; grid-template-columns:32px minmax(120px,1fr) minmax(220px,1.6fr) auto; align-items:end; gap:10px; min-width:0; padding:12px; border:1px solid #efb35f; border-radius:8px; background:#fffdf8; }
.program-item > label { min-width:0; font-size:12px; font-weight:400; }
.program-item > label input { min-width:0; min-height:34px; }
.program-key-check { align-self:center; justify-self:center; }
.program-key-check input { width:17px; height:17px; }
.program-actions { display:flex; gap:6px; align-items:end; }
.program-actions button,.program-actions .back-link { min-height:30px; padding:4px 9px; font-size:12px; font-weight:400; white-space:nowrap; }
.program-key-editor { grid-column:1 / -1; min-width:0; padding:8px 10px; border:1px dashed #efb35f; border-radius:6px; }
.program-key-editor summary { cursor:pointer; color:#bb620e; font-size:18px; font-weight:700; }
.program-key-editor-grid { display:grid; gap:10px; margin-top:10px; }
.key-editor-box { display:grid; gap:8px; min-width:0; padding:10px; border:1px solid #efb35f; border-radius:6px; background:#fff; }
.program-admin-layout .key-editor-box h3 { margin:0; color:#bb620e; font-size:13px; }
.access-month-row { display:grid; grid-template-columns:minmax(130px,1fr) minmax(130px,1fr) auto auto; gap:6px; align-items:end; margin-bottom:6px; }
.custom-key-row { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:6px; align-items:end; margin-bottom:6px; }
.custom-key-row button:nth-last-child(2) { grid-column:3; }
.custom-key-row button:last-child { grid-column:4; }
.access-month-row label,.custom-key-row label { min-width:0; color:#915011; font-size:12px; font-weight:400; }
.access-month-row input,.custom-key-row input { min-height:34px; min-width:0; }
.access-month-row button,.custom-key-row button,.key-editor-box > button,.key-shortcuts button { min-height:30px; padding:4px 8px; font-size:12px; font-weight:400; }
.key-shortcuts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-top:0; }
.program-output-panel { align-self:start; }
.program-output-panel > label { color:#705846; font-size:13px; font-weight:400; }
.program-output-actions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-top:30px; }
.program-output-actions button { min-height:85px; padding:8px; color:#70410c; border-color:#e98f24; background:#fff9ec; font-size:18px; }
.key-output { min-height:306px; margin-top:0; background:#fff; }
.program-output-panel .hint { font-size:12px; }
.modal-backdrop[hidden] { display:none; }
.modal-backdrop { position:fixed; inset:0; z-index:50; display:grid; place-items:center; padding:18px; background:#23191266; }
.modal-panel { width:min(480px,100%); padding:20px; border:2px solid #efb35f; border-radius:8px; background:#fffdf8; box-shadow:0 18px 36px #0004; }
.modal-panel h2 { margin-top:0; }
.modal-panel .toggle { justify-content:start; }
.modal-panel .toggle input { width:18px; height:18px; }
.modal-panel button:disabled { cursor:not-allowed; opacity:.45; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
@media (max-width:900px) { .program-admin-layout { grid-template-columns:1fr; } }
@media (max-width:700px) { .program-item { grid-template-columns:32px minmax(0,1fr); } .program-item > label:nth-child(3),.program-actions { grid-column:1 / -1; } .program-actions { justify-content:flex-end; } .access-month-row,.custom-key-row { grid-template-columns:repeat(2,minmax(0,1fr)); } .custom-key-row button:nth-last-child(2) { grid-column:1; } .custom-key-row button:last-child { grid-column:2; } .key-shortcuts { grid-template-columns:1fr; } }
@media (max-width:540px) { .program-output-actions { grid-template-columns:1fr; margin-top:16px; } .program-output-actions button { min-height:40px; font-size:15px; } }
