/* アサダ社内アプリ 共通デザイン（B案・密度型）
   ここを直すと全アプリの見た目が変わる。アプリ側で色や書体を上書きしない。 */

:root {
  --bg: #f2f4f6;
  --panel: #ffffff;
  --fg: #22262b;
  --muted: #5f666e;
  --faint: #8a919a;
  --line: #d9dee3;
  --line-soft: #eef1f4;
  --zebra: #fafbfc;
  --head: #f7f8fa;
  --accent: #0e6b57;
  --accent-hover: #0b5a49;
  --accent-bg: #e6f1ee;
  --danger: #b3261e;
  --danger-bg: #fbe9e7;
  --warn: #7a5200;
  --warn-bg: #fff4d6;
  --ok: #2e9e6b;
  --radius: 6px;
  --font: "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  --topbar-h: 44px;
  --sidebar-w: 216px;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 13px; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font); line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }
h1, h2, h3, h4 { font-weight: 500; margin: 0; line-height: 1.4; text-wrap: balance; }
h1 { font-size: 16px; }
h2 { font-size: 14px; }
h3 { font-size: 13px; }
p { margin: 0 0 8px; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }

/* アイコン */
.ic { width: 1.25em; height: 1.25em; stroke: currentColor; fill: none; stroke-width: 1.6;
      stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.3em; flex-shrink: 0; }

/* 上部バー */
.topbar {
  height: var(--topbar-h); background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
  position: sticky; top: 0; z-index: 10;
}
.topbar .brand { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; color: var(--fg); }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand .mark { width: 18px; height: 18px; border-radius: 4px; background: var(--accent); display: inline-block; }
.topbar .crumb { color: var(--muted); }
.topbar .crumb::before { content: "›"; margin-right: 10px; color: var(--faint); }
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--muted); }
.topbar .who strong { color: var(--fg); font-weight: 500; }
.topbar .who a { color: var(--accent); }

/* 枠 */
.layout { display: grid; grid-template-columns: 1fr; min-height: calc(100vh - var(--topbar-h)); }
.layout.has-sidebar { grid-template-columns: var(--sidebar-w) 1fr; }
.sidebar { background: var(--panel); border-right: 1px solid var(--line); padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.sidebar .nav { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--radius); color: #3d444c; }
.sidebar .nav .ic { width: 17px; height: 17px; color: #6b737c; }
.sidebar .nav:hover { background: var(--line-soft); text-decoration: none; }
.sidebar .nav.on { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.sidebar .nav.on .ic { color: var(--accent); }
.sidebar .sep { height: 1px; background: var(--line-soft); margin: 8px 6px; }
.sidebar .label { font-size: 11px; color: var(--faint); padding: 6px 10px 2px; letter-spacing: .04em; }
.main { padding: 16px 20px 40px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.main.narrow { max-width: 760px; }

/* 見出し行・ツールバー */
.hrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hrow h1 { margin-right: 4px; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* カード */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.card > h2, .card > .card-head {
  font-size: 13px; font-weight: 500; padding: 10px 14px; border-bottom: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
}
.card > h2 span, .card-head span { color: var(--faint); font-weight: 400; font-size: 12px; }
.card .body { padding: 14px; }
.card .foot { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line-soft); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 14px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* ボタン */
.btn {
  height: 30px; padding: 0 12px; border-radius: 5px; border: 1px solid #c9cfd6; background: var(--panel);
  display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; color: var(--fg);
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--line-soft); text-decoration: none; color: var(--fg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn.danger { color: var(--danger); border-color: #e2b3af; }
.btn.danger:hover { background: var(--danger-bg); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

/* フォーム */
input[type="text"], input[type="password"], input[type="date"], input[type="email"], input[type="number"], input[type="search"], select, textarea {
  height: 30px; border: 1px solid #c9cfd6; border-radius: 5px; background: var(--panel);
  padding: 0 10px; font: inherit; font-size: 13px; color: var(--fg);
}
textarea { height: auto; padding: 8px 10px; min-height: 80px; resize: vertical; }
select { padding-right: 26px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a919a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; }
input:disabled, select:disabled { background: var(--line-soft); color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > label { font-size: 12px; color: var(--muted); }
.field .help { font-size: 12px; color: var(--faint); }
.field .err { font-size: 12px; color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 6px; }
.check input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.inline-search { display: inline-flex; align-items: center; gap: 6px; height: 30px; border: 1px solid #c9cfd6; border-radius: 5px; background: var(--panel); padding: 0 8px; }
.inline-search .ic { color: var(--faint); }
.inline-search input { border: 0; height: 26px; padding: 0 4px; width: 200px; }
.inline-search input:focus-visible { outline: none; }
.sel { display: inline-flex; align-items: center; gap: 6px; }
.sel > span { font-size: 12px; color: var(--faint); }

/* 表 */
.table-wrap { overflow-x: auto; }
table.tbl { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.tbl th { height: 34px; padding: 0 10px; font-size: 12px; font-weight: 500; color: var(--muted); background: var(--head);
  border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl td { height: 34px; padding: 0 10px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.tbl tbody tr:nth-child(even) td { background: var(--zebra); }
.tbl tbody tr:hover td { background: var(--accent-bg); }
.tbl td.m, .tbl .m { color: var(--muted); font-size: 12px; }
.tbl th.sortable a { color: inherit; }
.tbl th.sortable a:hover { color: var(--accent); text-decoration: none; }
.tbl th.c, .tbl td.c { text-align: center; }
.tbl th.r, .tbl td.r { text-align: right; }
.tbl td .ic.ok { color: var(--accent); width: 15px; height: 15px; }
.tbl .row-link { color: inherit; }
.tbl tr.off td { color: var(--faint); }

/* 状態表示 */
.pill { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 3px; background: var(--accent-bg); color: var(--accent); line-height: 1.6; }
.pill.off { background: var(--line-soft); color: #6b737c; }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.danger { background: var(--danger-bg); color: var(--danger); }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 3px; background: var(--line-soft); color: #3d444c; }
.tag.a { background: var(--accent-bg); color: var(--accent); }

/* お知らせ・メッセージ */
.flash { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); display: flex; gap: 10px; align-items: flex-start; }
.flash.ok { background: var(--accent-bg); border-color: #b9d9d0; color: var(--accent); }
.flash.err { background: var(--danger-bg); border-color: #e2b3af; color: var(--danger); }
.flash.warn { background: var(--warn-bg); border-color: #e8d59a; color: var(--warn); }
.flashes { display: flex; flex-direction: column; gap: 8px; }

/* リスト行 */
.li { padding: 9px 14px; border-bottom: 1px solid var(--line-soft); font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.li:last-child { border-bottom: 0; }
.li .d { color: var(--faint); font-size: 11px; }
.kv { display: grid; grid-template-columns: 100px 1fr; gap: 6px 10px; padding: 12px 14px; font-size: 13px; }
.kv .k { color: var(--faint); font-size: 12px; }

/* タイル（ポータルのホーム） */
.tilegrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 12px 14px 14px; }
.tile { height: 66px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--fg); }
.tile .ic { width: 20px; height: 20px; color: currentColor; }
.tile:hover { border-color: currentColor; text-decoration: none; filter: brightness(0.97); }
.tile.dragging { opacity: .4; }
.tile.over { outline: 2px dashed var(--accent); outline-offset: -2px; }

/* ページ送り */
.pg { display: flex; gap: 4px; }
.pg a, .pg span { min-width: 24px; height: 24px; padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; background: var(--panel); color: var(--fg); font-size: 12px; }
.pg .on { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ログイン画面などの中央配置 */
.centered { min-height: calc(100vh - var(--topbar-h)); display: flex; align-items: flex-start; justify-content: center; padding-top: 10vh; }
.centered .card { width: 360px; }

/* 組織ツリー */
.tree .node { display: flex; align-items: center; gap: 8px; height: 32px; padding: 0 10px; border-bottom: 1px solid var(--line-soft); }
.tree .node .code { color: var(--faint); font-size: 12px; min-width: 40px; font-variant-numeric: tabular-nums; }
.tree .d1 { padding-left: 10px; } .tree .d2 { padding-left: 34px; } .tree .d3 { padding-left: 58px; } .tree .d4 { padding-left: 82px; }

@media (max-width: 900px) {
  .layout.has-sidebar { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-content: flex-start; border-right: 0; border-bottom: 1px solid var(--line); gap: 4px; }
  .sidebar .label, .sidebar .sep { display: none; }
  .cols { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .tilegrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
