﻿/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Tokens ── */
:root {
  --bg:       #ffffff;
  --bg-side:  #f4f5f7;
  --bg-surf:  #eef0f3;
  --bg-hov:   #ebedf1;
  --border:   #d0d2d9;
  --border-s: #b8bac5;
  --text-1:   #0c0c0e;
  --text-2:   #5a5c6b;
  --text-3:   #9fa1af;
  --text-4:   #c4c6d2;
  --accent:   #0c0c0e;
  --mono:     'Space Mono','Courier New',monospace;
  --sans:     'Inter','Noto Sans JP',sans-serif;
  --sb-w:     260px;
  --ease:     cubic-bezier(0.16,1,0.3,1);
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* LOGIN */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-box {
  width: 320px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 48px 40px 44px;
}

.login-box__hd { margin-bottom: 40px; }

.login-wordmark {
  display: block;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-1);
  margin-bottom: 6px;
}

.login-tagline {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 7px;
  letter-spacing: 0.01em;
}

.field-input {
  display: block;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-s);
  color: var(--text-1);
  font-family: var(--mono);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  border-radius: 0;
  appearance: none;
  transition: border-color 140ms;
}
.field-input:focus { border-color: var(--text-1); }

.field-error {
  font-size: 11px;
  color: #c0392b;
  min-height: 18px;
  margin-top: 8px;
}

.login-submit {
  display: block;
  width: 100%;
  background: var(--text-1);
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 12px;
  margin-top: 24px;
  cursor: pointer;
  border-radius: 0;
  transition: opacity 140ms;
}
.login-submit:hover  { opacity: 0.82; }
.login-submit:active { opacity: 0.65; }

/* APP SHELL */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* SIDEBAR */
.sidebar {
  width: var(--sb-w);
  min-width: var(--sb-w);
  background: var(--bg-side);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  transition: transform 260ms var(--ease), min-width 260ms var(--ease), width 260ms var(--ease);
  z-index: 20;
}

.sidebar.is-hidden {
  transform: translateX(-100%);
  position: absolute;
  height: 100%;
  min-width: 0;
  width: 0;
}

.sidebar-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-wordmark {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--text-1);
}

.sidebar-collapse-btn {
  background: none;
  border: 1px solid var(--border-s);
  color: var(--text-2);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 0;
  padding: 0;
  transition: color 130ms, background 130ms;
}
.sidebar-collapse-btn:hover { color: var(--text-1); background: var(--bg-surf); }

.sidebar-body {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.sidebar-ft {
  border-top: 1px solid var(--border);
  padding: 11px 14px;
  flex-shrink: 0;
}

.sidebar-open-btn {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 30;
  background: var(--bg);
  border: 1px solid var(--border-s);
  color: var(--text-2);
  width: 28px;
  height: 28px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 0;
  padding: 0;
  transition: color 130ms;
}
.sidebar-open-btn:hover { color: var(--text-1); }

/* Nav: Customer section */
.nav-section { border-bottom: 1px solid var(--border); }

.nav-section__hd {
  width: 100%;
  background: none;
  border: none;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  cursor: pointer;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 130ms, background 130ms;
}
.nav-section__hd:hover { color: var(--text-1); background: var(--bg-hov); }

.nav-section__arrow { font-size: 8px; flex-shrink: 0; opacity: 0.4; }
.nav-section__name  { flex: 1; }

.nav-section__tag {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.05em;
  border: 1px solid var(--border-s);
  color: var(--text-3);
  padding: 1px 4px;
}

/* Nav: Doc list */
.nav-docs { list-style: none; padding: 2px 0 4px; }

.nav-doc {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 6px 14px 6px 22px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 100ms;
}
.nav-doc:hover { background: var(--bg-hov); }
.nav-doc.is-active {
  background: var(--bg-surf);
  border-left-color: var(--text-1);
}
.nav-doc.is-active .nav-doc__id    { color: var(--text-1); }
.nav-doc.is-active .nav-doc__title { color: var(--text-1); }

.nav-doc__id {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-4);
  flex-shrink: 0;
  letter-spacing: 0.04em;
  transition: color 100ms;
}

.nav-doc__title {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.4;
  transition: color 100ms;
}
.nav-doc:hover .nav-doc__title { color: var(--text-1); }

/* VIEWER */
.viewer {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.viewer-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.viewer-empty__mark {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.28em;
  color: var(--text-4);
}

.viewer-empty__hint {
  font-size: 12px;
  color: var(--text-4);
}

.viewer-active {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.viewer-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 28px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.viewer-bar__id {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-3);
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.viewer-bar__sep {
  width: 1px;
  height: 12px;
  background: var(--border);
  flex-shrink: 0;
}

.viewer-bar__title {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.viewer-bar__actions { display: flex; gap: 6px; flex-shrink: 0; }

.viewer-scroll {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* Doc body */
.doc-body {
  max-width: 760px;
  margin: 0 auto;
  padding: 52px 56px 72px;
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--text-1);
}

.doc-body.loading { opacity: 0.25; pointer-events: none; }

.doc-body p { margin-bottom: 0.85em; }
.doc-body h1,.doc-body h2,.doc-body h3,.doc-body h4 {
  font-weight: 600;
  margin-top: 2.2em;
  margin-bottom: 0.5em;
  line-height: 1.35;
  color: var(--text-1);
}
.doc-body h1 { font-size: 18px; }
.doc-body h2 { font-size: 14px; border-bottom: 1px solid var(--border); padding-bottom: 0.4em; }
.doc-body h3 { font-size: 13px; }
.doc-body h4 { font-size: 12px; color: var(--text-2); }

.doc-body ul,.doc-body ol { padding-left: 1.6em; margin-bottom: 0.85em; }
.doc-body li { margin-bottom: 0.2em; }
.doc-body strong { font-weight: 600; }

.doc-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-size: 12px;
}
.doc-body th,.doc-body td {
  border: 1px solid var(--border);
  padding: 7px 11px;
  text-align: left;
  vertical-align: top;
}
.doc-body th {
  background: var(--bg-side);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* REVIEW */
.review-pane {
  border-top: 1px solid var(--border);
  padding: 14px 28px 16px;
  flex-shrink: 0;
  background: var(--bg);
}

.review-pane__label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.04em;
  margin-bottom: 7px;
}

.review-input {
  width: 100%;
  background: var(--bg-side);
  border: 1px solid var(--border);
  color: var(--text-1);
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.6;
  padding: 9px 12px;
  min-height: 64px;
  resize: vertical;
  outline: none;
  border-radius: 0;
  transition: border-color 130ms;
}
.review-input:focus { border-color: var(--border-s); }
.review-input::placeholder { color: var(--text-4); }

.review-pane__ft {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 7px;
}

.review-status {
  font-size: 10px;
  color: var(--text-3);
}

/* BUTTONS */
.btn-tool {
  font-size: 11px;
  font-weight: 500;
  background: none;
  border: 1px solid var(--border-s);
  color: var(--text-2);
  padding: 5px 12px;
  cursor: pointer;
  border-radius: 0;
  transition: border-color 130ms, color 130ms;
}
.btn-tool:hover { border-color: var(--text-1); color: var(--text-1); }

.btn-save {
  font-size: 10px;
  font-weight: 500;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-3);
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 0;
  transition: border-color 130ms, color 130ms;
}
.btn-save:hover { border-color: var(--border-s); color: var(--text-2); }

.logout-btn {
  font-size: 11px;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 0;
  transition: color 130ms;
}
.logout-btn:hover { color: var(--text-2); }

/* PRINT */
@media print {
  .sidebar,.sidebar-open-btn,.viewer-bar,.review-pane { display: none !important; }
  html, body { overflow: visible; height: auto; background: white; }
  .app-shell { display: block; }
  .viewer,.viewer-scroll { overflow: visible; }
  .doc-body { max-width: none; padding: 0; font-size: 11pt; }
}

/* RESPONSIVE */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100%;
    z-index: 100;
    box-shadow: 2px 0 16px rgba(0,0,0,0.12);
  }
  .sidebar.is-hidden { transform: translateX(-100%); }
  .doc-body { padding: 28px 20px 48px; }
}
/* ── 顧客追加ボタン・フォーム ── */
.nav-add-wrap {
  padding: 10px 14px;
}

.nav-add-btn {
  width: 100%;
  background: none;
  border: 1px dashed var(--border-s);
  color: var(--text-3);
  font-size: 11px;
  padding: 7px 12px;
  cursor: pointer;
  text-align: left;
  border-radius: 0;
  transition: border-color 130ms, color 130ms;
}
.nav-add-btn:hover { border-color: var(--text-2); color: var(--text-2); }

.nav-add-form {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nav-add-input {
  width: 100%;
  border: 1px solid var(--border-s);
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--sans);
  font-size: 12px;
  padding: 7px 10px;
  outline: none;
  border-radius: 0;
  transition: border-color 130ms;
}
.nav-add-input:focus { border-color: var(--text-1); }
.nav-add-input::placeholder { color: var(--text-4); }

.nav-add-actions {
  display: flex;
  gap: 6px;
}

.nav-add-ok {
  flex: 1;
  background: var(--text-1);
  border: none;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 6px 0;
  cursor: pointer;
  border-radius: 0;
  transition: opacity 130ms;
}
.nav-add-ok:hover { opacity: 0.78; }

.nav-add-cancel {
  background: none;
  border: 1px solid var(--border-s);
  color: var(--text-3);
  font-size: 11px;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 0;
  transition: color 130ms;
}
.nav-add-cancel:hover { color: var(--text-2); }

/* 削除ボタン（×） */
.nav-section__del {
  background: none;
  border: none;
  color: var(--text-4);
  font-size: 13px;
  padding: 0 0 0 4px;
  cursor: pointer;
  line-height: 1;
  transition: color 120ms;
  flex-shrink: 0;
}
.nav-section__del:hover { color: #c0392b; }

/* ── 管理リンク（サイドバー下部） ── */
.sidebar-ft {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mgmt-link {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-align: left;
  transition: color 130ms;
  letter-spacing: 0.02em;
}
.mgmt-link:hover { color: var(--text-1); }

/* ── アーカイブボタン（サイドバー各顧客） ── */
.nav-section__hd {
  display: flex;
  align-items: center;
  border-bottom: none;
}

.nav-section__toggle {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  cursor: pointer;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  transition: color 130ms, background 130ms;
}
.nav-section__toggle:hover { color: var(--text-1); background: var(--bg-hov); }

.nav-section__arch {
  background: none;
  border: none;
  color: var(--text-4);
  font-size: 14px;
  padding: 8px 12px 8px 4px;
  cursor: pointer;
  transition: color 130ms;
  flex-shrink: 0;
  line-height: 1;
}
.nav-section__arch:hover { color: var(--text-2); }

/* ── 管理ビュー ── */
.viewer-mgmt {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mgmt-bar {
  padding: 11px 28px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.mgmt-bar__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: 0.02em;
}

.mgmt-scroll {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.mgmt-body {
  max-width: 640px;
  margin: 0 auto;
  padding: 36px 48px 64px;
}

.mgmt-empty {
  font-size: 12px;
  color: var(--text-4);
  margin-top: 8px;
}

.mgmt-section {
  margin-bottom: 40px;
}

.mgmt-section__title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.mgmt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  margin-bottom: 2px;
}

.mgmt-row__name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
}

.mgmt-row__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* 管理ボタン */
.btn-mgmt {
  font-size: 11px;
  background: none;
  border: 1px solid var(--border-s);
  color: var(--text-2);
  padding: 5px 11px;
  cursor: pointer;
  border-radius: 0;
  transition: border-color 130ms, color 130ms;
}
.btn-mgmt:hover { border-color: var(--text-1); color: var(--text-1); }

.btn-mgmt--del {
  color: var(--text-3);
  border-color: var(--border);
}
.btn-mgmt--del:hover { border-color: #c0392b; color: #c0392b; }

/* 削除エリア */
.mgmt-del-area {
  margin-bottom: 2px;
}

.mgmt-del-box {
  border: 1px solid var(--border-s);
  border-top: 2px solid var(--text-1);
  background: var(--bg-side);
  padding: 20px 18px 16px;
  margin-bottom: 2px;
}

.mgmt-del-box__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 8px;
}

.mgmt-del-box__note {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.6;
  margin-bottom: 16px;
}

.mgmt-del-list {
  list-style: none;
  border-top: 1px solid var(--border);
  margin-bottom: 16px;
}

.mgmt-del-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.mgmt-del-item__info {
  flex: 1;
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.mgmt-del-item__id {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-4);
  flex-shrink: 0;
}

.btn-del-file {
  font-size: 10px;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-3);
  padding: 4px 9px;
  cursor: pointer;
  border-radius: 0;
  flex-shrink: 0;
  transition: border-color 130ms, color 130ms;
}
.btn-del-file:hover { border-color: #c0392b; color: #c0392b; }

.mgmt-del-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
}

.btn-del-all {
  font-size: 11px;
  font-weight: 500;
  background: #c0392b;
  border: none;
  color: #fff;
  padding: 7px 16px;
  cursor: pointer;
  border-radius: 0;
  transition: opacity 130ms;
}
.btn-del-all:hover { opacity: 0.82; }

/* ── 削除 2段階フロー: チェックボックス選択 ─── */

.del-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.del-check-row--all {
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--border-s);
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-1);
}

.del-cb {
  width: 14px;
  height: 14px;
  border: 1px solid var(--border-s);
  background: var(--bg);
  border-radius: 0;
  cursor: pointer;
  flex-shrink: 0;
  accent-color: var(--text-1);
}

.del-check-info {
  display: flex;
  align-items: baseline;
  gap: 9px;
  font-size: 12px;
  color: var(--text-2);
}

.mgmt-del-item .del-check-row { padding: 9px 0; width: 100%; }
.mgmt-del-item { padding: 0; }

.btn-del-exec {
  font-size: 11px;
  font-weight: 500;
  background: var(--text-1);
  border: none;
  color: #fff;
  padding: 7px 16px;
  cursor: pointer;
  border-radius: 0;
  transition: opacity 130ms;
}
.btn-del-exec:hover:not(:disabled) { opacity: 0.75; }
.btn-del-exec:disabled {
  background: var(--bg-surf);
  color: var(--text-4);
  cursor: not-allowed;
}
