/* =========================================================
   HCR BASE - Stylesheet
   Tailwind CDN の代わりに、必要なものだけを手書きで用意する。
   ブラウザ側でCSSを生成しないため、読み込みが速い。
   ========================================================= */

:root {
  --navy:        #1e3a8a;
  --navy-deep:   #0f1c3f;
  --navy-soft:   #312e81;
  --ink:         #334155;
  --ink-strong:  #1e293b;
  --ink-soft:    #64748b;
  --ink-faint:   #94a3b8;
  --line:        #e2e8f0;
  --line-soft:   #f1f5f9;
  --paper:       #f8fafc;
  --white:       #ffffff;
  --cyan:        #22d3ee;

  --green:       #059669;
  --green-bg:    #d1fae5;
  --amber:       #b45309;
  --amber-bg:    #fef3c7;
  --red:         #dc2626;
  --red-bg:      #fee2e2;
  --blue:        #1d4ed8;
  --blue-bg:     #dbeafe;
  --indigo:      #4338ca;
  --indigo-bg:   #e0e7ff;
  --teal:        #0f766e;
  --teal-bg:     #ccfbf1;
  --orange:      #c2410c;
  --orange-bg:   #ffedd5;
  --gray:        #475569;
  --gray-bg:     #e2e8f0;

  --radius:      10px;
  --radius-lg:   16px;
  --shadow:      0 10px 30px rgba(15, 23, 42, .05);
  --shadow-sm:   0 1px 3px rgba(15, 23, 42, .08);

  /* 文字サイズの倍率。小 .92 / 中 1 / 大 1.12 / 特大 1.25 */
  --fs: 1;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-size: calc(14px * var(--fs));
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.cyber-font { font-family: 'Orbitron', monospace; letter-spacing: .02em; }

/* ---------------- 画面の骨組み ---------------- */

.shell { display: flex; height: 100vh; overflow: hidden; }

.main {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}

.wrap {
  padding: calc(24px * var(--fs)) calc(28px * var(--fs));
  max-width: 1600px;
  margin: 0 auto;
}

/* ---------------- サイドバー ---------------- */

.side {
  width: 248px;
  flex: 0 0 auto;
  background: linear-gradient(to bottom, var(--navy), var(--navy-deep));
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  box-shadow: 4px 0 24px rgba(15, 23, 42, .4);
  position: relative;
  overflow: hidden;
  z-index: 20;
}

.side__brand { padding: 22px 22px 16px; }
.side__logo { display: flex; align-items: baseline; gap: 6px; }
.side__logo b { font-family: 'Orbitron', monospace; font-size: 26px; font-weight: 800; color: #fff; letter-spacing: .12em; }
.side__logo span { font-family: 'Orbitron', monospace; font-size: 26px; font-weight: 800; color: rgba(34,211,238,.85); letter-spacing: .12em; }
.side__corp { display: flex; align-items: center; gap: 7px; margin-top: 6px; }
.side__dot { width: 6px; height: 6px; border-radius: 50%; background: #34d399; flex: 0 0 auto; }
.side__corp small { font-size: 10px; color: #94a3b8; font-weight: 700; letter-spacing: .04em; }

.side__me {
  margin: 0 14px 16px;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.10);
}
.side__me-row { display: flex; align-items: center; gap: 12px; }
.side__avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(to top right, #22d3ee, #3b82f6);
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex: 0 0 auto;
}
.side__me-pos { font-size: 10px; font-weight: 700; color: rgba(34,211,238,.9); }
.side__me-name { font-size: 14px; font-weight: 900; color: #fff; }
.side__me-meta { margin-top: 10px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,.06); }
.side__me-line { display: flex; justify-content: space-between; align-items: center; margin-top: 5px; }
.side__me-line small { font-size: 10px; color: #64748b; }
.side__me-line b { font-size: 11px; color: #e2e8f0; font-weight: 700; }

.side__nav { flex: 1; padding: 0 14px 16px; overflow-y: auto; }
.side__label { font-size: 10px; font-weight: 700; color: rgba(147,197,253,.45); letter-spacing: .16em; text-transform: uppercase; margin: 14px 8px 8px; }

.side__item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius);
  font-size: 12px; font-weight: 500; color: #cbd5e1;
  transition: background .2s, color .2s;
}
.side__item:hover { background: rgba(255,255,255,.05); color: #fff; }
.side__item.is-active { background: rgba(255,255,255,.10); color: #fff; font-weight: 700; }
.side__item.is-active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 66%; background: var(--cyan); border-radius: 0 3px 3px 0;
}
.side__item i { font-size: 12px; color: #64748b; width: 14px; text-align: center; }
.side__item.is-active i { color: var(--cyan); }

.side__foot {
  padding: 14px; border-top: 1px solid rgba(255,255,255,.06);
  background: rgba(0,0,0,.10);
}
.side__fs { display: flex; gap: 4px; margin-top: 8px; }
.side__fs a {
  flex: 1; text-align: center; padding: 6px 0; border-radius: 8px;
  font-size: 11px; font-weight: 700; color: #94a3b8; transition: background .2s, color .2s;
}
.side__fs a:hover { background: rgba(255,255,255,.05); color: #fff; }
.side__fs a.is-on { background: rgba(255,255,255,.15); color: #fff; box-shadow: inset 0 0 0 1px rgba(34,211,238,.5); }

/* ---------------- 見出し ---------------- */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: calc(22px * var(--fs)); }
.page-eyebrow { display: flex; align-items: center; gap: 7px; font-family: 'Orbitron', monospace; font-size: 11px; font-weight: 700; color: rgba(30,58,138,.6); letter-spacing: .16em; text-transform: uppercase; margin-bottom: 4px; }
.page-title { font-size: calc(24px * var(--fs)); font-weight: 900; color: var(--ink-strong); margin: 0; }
.page-sub { font-size: calc(12px * var(--fs)); font-weight: 700; color: var(--ink-soft); margin: 4px 0 0; }

/* ---------------- カード ---------------- */

.panel {
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(226,232,240,.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.panel--flush { overflow: hidden; }
.panel__pad { padding: calc(18px * var(--fs)); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: rgba(255,255,255,.9); border: 1px solid rgba(226,232,240,.8); border-radius: var(--radius-lg); padding: 16px 20px; box-shadow: var(--shadow); }
.stat__label { font-size: 10px; font-weight: 700; color: var(--ink-faint); margin-bottom: 4px; }
.stat__value { font-family: 'Orbitron', monospace; font-size: calc(24px * var(--fs)); font-weight: 900; color: var(--ink-strong); }
.stat__unit { font-size: 11px; color: var(--ink-faint); margin-left: 2px; }

/* ---------------- フォーム ---------------- */

.field { margin-bottom: 14px; }
.field__label { display: block; font-size: 11px; font-weight: 700; color: var(--navy); margin-bottom: 5px; }
.field__hint { font-size: 10px; font-weight: 700; color: var(--ink-faint); margin-top: 4px; }

.input, .select, .textarea {
  width: 100%;
  padding: calc(9px * var(--fs)) 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.9);
  font-size: calc(13px * var(--fs));
  font-weight: 700;
  color: var(--ink-strong);
  font-family: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.textarea { font-weight: 500; resize: vertical; }
.select { cursor: pointer; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(30,58,138,.15);
}

.input-search { position: relative; }
.input-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: 12px; }
.input-search .input { padding-left: 34px; }

.check { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; cursor: pointer; user-select: none; font-size: 13px; font-weight: 700; }
.check:hover { background: var(--line-soft); }
.check input { width: 16px; height: 16px; accent-color: var(--navy); cursor: pointer; }
.check.is-on { border-color: var(--teal); background: var(--teal-bg); }

/* ---------------- ボタン ---------------- */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: calc(9px * var(--fs)) 18px;
  border: 1px solid transparent; border-radius: var(--radius);
  font-size: calc(12px * var(--fs)); font-weight: 700;
  cursor: pointer; transition: all .2s; white-space: nowrap;
}
.btn--primary { background: linear-gradient(to right, var(--navy), var(--navy-soft)); color: #fff; }
.btn--primary:hover { box-shadow: 0 8px 20px rgba(30,58,138,.3); transform: translateY(-1px); }
.btn--ghost { background: #fff; border-color: var(--line); color: var(--ink-soft); }
.btn--ghost:hover { background: var(--line-soft); border-color: var(--ink-faint); }
.btn--sm { padding: 6px 12px; font-size: 11px; }

/* ---------------- 表 ---------------- */

.table-scroll { overflow-x: auto; }
.table-scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.table-scroll::-webkit-scrollbar-track { background: rgba(0,0,0,.02); border-radius: 10px; }
.table-scroll::-webkit-scrollbar-thumb { background: rgba(30,58,138,.2); border-radius: 10px; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: rgba(30,58,138,.4); }

.table { width: 100%; border-collapse: collapse; font-size: calc(12px * var(--fs)); }
.table th {
  position: sticky; top: 0; z-index: 10;
  background: #f1f5f9;
  padding: calc(12px * var(--fs)) 14px;
  text-align: left;
  font-size: calc(11px * var(--fs)); font-weight: 700; color: var(--ink-soft);
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: calc(12px * var(--fs)) 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr:hover { background: rgba(219,234,254,.3); }
.table__empty { padding: 60px 20px; text-align: center; color: var(--ink-faint); font-weight: 700; }

/* 並び替えできる見出し */
.th-sort { color: inherit; display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
.th-sort:hover { color: var(--navy); }
.th-sort i { font-size: 11px; color: var(--ink-faint); }
.th-sort.is-on { color: var(--navy); font-weight: 900; }
.th-sort.is-on i { color: var(--navy); font-size: 13px; }
th:has(.th-sort.is-on) { background: rgba(30,58,138,.08); }

.muted { color: #cbd5e1; }

/* ---------------- ラベル ---------------- */

.tag {
  display: inline-block; padding: 3px 9px; border-radius: 7px;
  font-size: calc(10px * var(--fs)); font-weight: 900; border: 1px solid;
  white-space: nowrap;
}
.tag--green  { color: var(--green);  background: var(--green-bg);  border-color: #a7f3d0; }
.tag--amber  { color: var(--amber);  background: var(--amber-bg);  border-color: #fde68a; }
.tag--red    { color: var(--red);    background: var(--red-bg);    border-color: #fecaca; }
.tag--blue   { color: var(--blue);   background: var(--blue-bg);   border-color: #bfdbfe; }
.tag--indigo { color: var(--indigo); background: var(--indigo-bg); border-color: #c7d2fe; }
.tag--teal   { color: var(--teal);   background: var(--teal-bg);   border-color: #99f6e4; }
.tag--orange { color: var(--orange); background: var(--orange-bg); border-color: #fed7aa; }
.tag--gray   { color: var(--gray);   background: var(--gray-bg);   border-color: #cbd5e1; }

/* ---------------- 絞り込みバー ---------------- */

.filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filter__grow { flex: 1; min-width: 220px; }
.filter__col { width: 160px; }

/* ---------------- ページ送り ---------------- */

.pager { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line-soft); }
.pager__info { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.pager nav { display: flex; }
.pagination { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.pagination .page-item .page-link {
  display: block; padding: 6px 12px; border-radius: 8px;
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
  border: 1px solid var(--line); background: #fff;
}
.pagination .page-item.active .page-link { background: var(--navy); border-color: var(--navy); color: #fff; }
.pagination .page-item.disabled .page-link { opacity: .4; }

/* ---------------- 通知 ---------------- */

.flash {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px; border-radius: var(--radius-lg);
  font-size: 12px; font-weight: 700; margin-bottom: 18px; border: 1px solid;
}
.flash--success { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.flash--error   { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

/* ---------------- ログイン ---------------- */

.login { display: flex; align-items: center; justify-content: center; height: 100vh; position: relative; overflow: hidden; }
.login__glow { position: fixed; width: 600px; height: 600px; border-radius: 50%; filter: blur(90px); pointer-events: none; z-index: 0; }
.login__glow--a { top: -10%; right: -10%; background: rgba(30,58,138,.2); }
.login__glow--b { bottom: -10%; left: -10%; background: rgba(49,46,129,.2); }
.login__card {
  position: relative; z-index: 1; width: 100%; max-width: 420px; margin: 0 16px;
  padding: 34px; border-radius: var(--radius-lg);
  background: rgba(255,255,255,.85); backdrop-filter: blur(20px);
  border: 1px solid rgba(226,232,240,.9);
  box-shadow: 0 20px 50px rgba(15,23,42,.15);
}
.login__bar { position: absolute; top: 0; left: 25%; right: 25%; height: 3px; border-radius: 3px; background: linear-gradient(to right, transparent, var(--navy), transparent); }
.login__brand { text-align: center; margin-bottom: 34px; }
.login__brand b { font-family: 'Orbitron', monospace; font-size: 30px; font-weight: 700; color: var(--navy); letter-spacing: .14em; }
.login__brand span { font-family: 'Orbitron', monospace; font-size: 30px; font-weight: 700; color: var(--navy-soft); letter-spacing: .14em; margin-left: 8px; }
.login__brand p { font-size: 12px; font-weight: 700; color: var(--ink-soft); margin: 8px 0 0; letter-spacing: .08em; }
.login__field { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.9); }
.login__field:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(30,58,138,.15); }
.login__field i { color: var(--navy); }
.login__field input { flex: 1; border: none; outline: none; background: transparent; font-size: 14px; font-weight: 700; color: var(--ink-strong); font-family: inherit; }
.login__submit {
  width: 100%; padding: 15px; border: none; border-radius: var(--radius);
  background: linear-gradient(90deg, var(--navy), var(--navy-soft));
  color: #fff; font-family: 'Orbitron', monospace; font-size: 13px; font-weight: 700;
  letter-spacing: .16em; text-transform: uppercase; cursor: pointer; transition: all .3s;
}
.login__submit:hover { box-shadow: 0 8px 25px rgba(30,58,138,.4); transform: translateY(-2px); }
.login__ver { display: block; text-align: center; margin-top: 28px; font-family: 'Orbitron', monospace; font-size: 10px; font-weight: 700; color: var(--ink-faint); letter-spacing: .16em; }

/* ---------------- 補助 ---------------- */

.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 8px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.text-sm { font-size: calc(12px * var(--fs)); }
.text-xs { font-size: calc(11px * var(--fs)); }
.bold { font-weight: 700; } .black { font-weight: 900; }
.nowrap { white-space: nowrap; }
.error-text { color: var(--red); font-size: 11px; font-weight: 700; margin-top: 4px; }

@media (max-width: 900px) {
  .side { width: 68px; }
  .side__brand, .side__me, .side__label, .side__item span, .side__fs { display: none; }
  .side__item { justify-content: center; }
}
