* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", "Hiragino Kaku Gothic ProN", sans-serif; background: #f4f6f8; color: #222; }
.hidden { display: none !important; }

.login-screen { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-box { background: #fff; padding: 40px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.1); width: 320px; text-align: center; }
.login-box h1 { font-size: 18px; margin-bottom: 20px; }
.login-box input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 4px; }
.login-box button { width: 100%; padding: 10px; background: #2c5282; color: #fff; border: none; border-radius: 4px; cursor: pointer; }
.error { color: #c53030; font-size: 13px; min-height: 18px; }

.app { display: flex; height: 100vh; }
.sidebar { width: 220px; background: #1a2332; color: #fff; display: flex; flex-direction: column; padding: 16px 0; flex-shrink: 0; }
.sidebar h2 { font-size: 16px; padding: 0 16px 12px; margin: 0; border-bottom: 1px solid #2d3a4f; }
.sidebar nav { flex: 1; display: flex; flex-direction: column; margin-top: 8px; overflow-y: auto; }
.sidebar nav a { display: flex; align-items: center; gap: 10px; color: #cbd5e0; text-decoration: none; padding: 10px 16px; font-size: 14px; }
.sidebar nav a:hover, .sidebar nav a.active { background: #2c5282; color: #fff; }
.sidebar nav a svg { width: 18px; height: 18px; flex-shrink: 0; fill: currentColor; }
.logout { margin: 12px 16px 0; padding: 8px; background: #4a5568; color: #fff; border: none; border-radius: 4px; cursor: pointer; }

.main-content { flex: 1; padding: 24px; overflow-y: auto; }
h3 { margin-top: 0; }

table { width: 100%; border-collapse: collapse; background: #fff; margin-top: 12px; font-size: 13px; }
th, td { border: 1px solid #e2e8f0; padding: 6px 8px; text-align: left; }
th { background: #edf2f7; }
tr:hover { background: #f9fafb; }
td[contenteditable="true"] { cursor: text; }
td[contenteditable="true"]:focus { outline: 2px solid #2c5282; outline-offset: -2px; background: #fffbea; }

.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding: 6px; border: 1px solid #ccc; border-radius: 4px; }
button { padding: 6px 14px; background: #2c5282; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-size: 13px; }
button.secondary { background: #718096; }
button.danger { background: #c53030; }
button:hover { opacity: .9; }
button:disabled { opacity: .5; cursor: not-allowed; }

.upload-box { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 20px; }
.upload-box .file-list { font-size: 12px; color: #718096; margin-top: 8px; }
.status-line { font-size: 13px; margin-top: 10px; }
.status-line.ok { color: #2f855a; }
.status-line.err { color: #c53030; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid #cbd5e0; border-top-color: #2c5282; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; padding: 24px; border-radius: 8px; width: 640px; max-height: 85vh; overflow-y: auto; }
.modal h3 { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.form-grid label { display: flex; flex-direction: column; font-size: 12px; color: #4a5568; gap: 4px; }
.form-grid input, .form-grid select, .form-grid textarea { padding: 6px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; }
.modal-actions { margin-top: 16px; display: flex; gap: 8px; justify-content: flex-end; }

/* ── 受注管理（Conair配色） ── */
.login-box button, button { background: #1a1816; }
button.secondary { background: #8a8580; }
.sidebar { background: #1a1816; }
.sidebar h2 { border-bottom-color: #33302d; }
.sidebar nav a:hover, .sidebar nav a.active { background: #ba78ed; color: #1a1816; }
.shop-link { display: block; margin: 8px 16px 0; padding: 8px; text-align: center; border-radius: 6px; background: #ba78ed; color: #1a1816; font-size: 13px; font-weight: 700; text-decoration: none; }
.login-screen { background: #ba78ed; }
h3 .sub { font-size: 13px; color: #888; font-weight: 400; margin-left: 8px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { background: #fff; border-radius: 10px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(0,0,0,.06); display: flex; flex-direction: column; }
.kpi span { font-size: 12px; color: #666; }
.kpi b { font-size: 30px; line-height: 1.2; }
.kpi small { color: #888; }
.kpi.accent { background: #f4ecfd; }
.tabs { display: inline-flex; background: #e9e6e3; border-radius: 8px; padding: 3px; }
.tab { background: transparent; color: #444; padding: 6px 14px; }
.tab.on { background: #fff; color: #1a1816; font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.filebtn { position: relative; overflow: hidden; display: inline-block; padding: 6px 14px; background: #8a8580; color: #fff; border-radius: 4px; font-size: 13px; cursor: pointer; }
.filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.muted { color: #888; font-size: 12px; }
.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; background: #eee; white-space: nowrap; }
.pill.warn { background: #fff1d6; color: #9a5b00; }
.pill.ok { background: #e1f5ea; color: #1f8a5b; }
.st { font-size: 12px; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.st-received { background: #f4ecfd; color: #5b2ba3; }
.st-confirmed { background: #dff3ff; color: #0b4a6e; }
.st-shipped { background: #e1f5ea; color: #1f8a5b; }
.st-cancelled { background: #eee; color: #777; }
tr.has-warn td:first-child { box-shadow: inset 3px 0 0 #f0a500; }
.orders-table td { vertical-align: top; }
.modal.wide { width: 900px; max-width: 95vw; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.modal-head h3 { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; font-size: 13px; }
.lbl { font-size: 11px; color: #888; font-weight: 700; }
.notebox { background: #fffbea; padding: 8px 12px; border-radius: 6px; margin-top: 10px; font-size: 13px; }
.chk { font-size: 13px; padding: 6px 10px; border-radius: 6px; margin: 4px 0; }
.chk.warn { background: #fff1d6; color: #9a5b00; }
.chk.info { background: #f4ecfd; color: #5b2ba3; }
.chk.ok { background: #e1f5ea; color: #1f8a5b; }
.thread { display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 75%; padding: 8px 12px; border-radius: 10px; font-size: 13px; white-space: pre-wrap; }
.msg.customer { background: #f4ecfd; align-self: flex-start; }
.msg.staff { background: #edf2f7; align-self: flex-end; }
.msg small { color: #888; font-size: 11px; }
.modal-actions input { padding: 6px; border: 1px solid #ccc; border-radius: 4px; }
.card-box { background: #fff; border-radius: 10px; padding: 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); font-size: 13px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 15px; }
.inline-form { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.inline-form input { padding: 5px; border: 1px solid #ccc; border-radius: 4px; width: 150px; }
details.mail { background: #fff; border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; font-size: 13px; }
details.mail summary { cursor: pointer; }
details.mail pre { white-space: pre-wrap; font-family: inherit; background: #f7f6f4; padding: 10px; border-radius: 6px; }
@media (max-width: 900px) { .kpis { grid-template-columns: 1fr 1fr; } .grid2 { grid-template-columns: 1fr; } }
.table-wrap { overflow-x: auto; }
.orders-table { min-width: 1150px; }
.orders-table td { white-space: nowrap; }
.orders-table td:nth-child(4), .orders-table td:nth-child(5) { white-space: normal; min-width: 150px; }
.orders-table td button { white-space: nowrap; }
