:root{
  --bg:#1a1f2a;
  --card:#262c3a;
  --text:#f8fbff;
  --muted:#cad2df;
  --line:#4a5566;
  --accent:#87e3ff;
  --warn:#ffd97a;
  --bad:#ff8383;
  --good:#92ffc1;
  --grid-col-width:360px;
  --grid-label-width:128px;
  --font-base:14px;
  --font-small:12px;
  --font-muted:13px;
  --font-title:14px;
  --font-button:12px;
}

body.font-small{
  --font-base:12px;
  --font-small:10px;
  --font-muted:11px;
  --font-title:11px;
  --font-button:11px;
}

body.font-medium{
  --font-base:14px;
  --font-small:12px;
  --font-muted:13px;
  --font-title:14px;
  --font-button:12px;
}

body.font-large{
  --font-base:16px;
  --font-small:14px;
  --font-muted:15px;
  --font-title:16px;
  --font-button:14px;
}

*{box-sizing:border-box}
html,
body{
  height:100%;
}
body{
  margin:0;
  min-height:100vh;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
  background:linear-gradient(180deg, #1d2330 0%, var(--bg) 100%);
  color:var(--text);
  overflow-x:hidden;
  overflow-y:auto;
}
a{color:inherit}
.link{color:var(--accent); text-decoration:none}
.link:hover{text-decoration:underline}

.topbar{
  position:sticky; top:0;
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 16px;
  background:#212735;
  border-bottom:1px solid var(--line);
  z-index:10;
}
.brand{font-weight:700}
.topbar-right{
  display:flex;
  flex-direction:column;
  align-items:flex-end;
  gap:8px;
}
.account-row{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
}
.font-size-controls{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
}
.container{
  max-width:100%;
  min-height:calc(100vh - 57px);
  height:auto;
  margin:0 auto;
  padding:16px;
  overflow:visible;
}
.card{
  background:linear-gradient(180deg, #2a3040 0%, var(--card) 100%);
  border:1px solid var(--line);
  border-radius:12px;
  padding:14px;
  margin-bottom:16px;
}
h2{margin:0 0 12px 0; font-size:18px}
.section-header-row{display:flex; align-items:center; justify-content:space-between; margin-bottom:12px}
.section-header-row h2{margin:0}
.required{color:var(--bad); margin-left:2px}
.muted{color:var(--muted); font-size:12px}
.hint{margin-top:8px}
.row{display:flex; gap:10px; align-items:center; margin:8px 0}
.row label{width:120px; color:var(--muted); font-size:12px}
.row input, .row select, .row textarea{
  flex:1;
  background:#2b3140;
  border:1px solid var(--line);
  color:var(--text);
  border-radius:10px;
  padding:10px;
  font-size:13px;
}
.row textarea{resize:vertical}
.filter-list{
  flex:1;
  display:flex;
  flex-wrap:wrap;
  gap:8px 16px;
  background:#2b3140;
  border:1px solid var(--line);
  border-radius:10px;
  padding:10px;
  min-height:44px;
}
.report-output{
  width:100%;
  min-height:360px;
  background:#2b3140;
  border:1px solid var(--line);
  color:var(--text);
  border-radius:12px;
  padding:12px;
  font-size:12px;
  line-height:1.6;
  resize:vertical;
}
.report-preview-wrap{
  margin-top:16px;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.report-preview{
  background:#2b3140;
  border:1px solid var(--line);
  border-radius:12px;
  padding:16px;
  font-size:13px;
  line-height:1.7;
  color:var(--text);
  overflow:auto;
}
.report-preview h1,
.report-preview h2,
.report-preview h3{
  margin:12px 0 8px;
}
.report-preview ul{
  margin:8px 0 12px 18px;
  padding:0;
}
.report-preview table{
  width:100%;
  border-collapse:collapse;
  margin:8px 0 16px;
  font-size:12px;
}
.report-preview th,
.report-preview td{
  border:1px solid var(--line);
  padding:6px 8px;
  text-align:center;
}
.report-preview th{
  background:#121622;
}
.assignee-list{
  flex:1;
  display:flex;
  flex-wrap:wrap;
  gap:6px 10px;
  background:#2b3140;
  border:1px solid var(--line);
  border-radius:10px;
  padding:8px;
  max-height:140px;
  overflow:auto;
}
.assignee-compact{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.assignee-compact-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.assignee-summary{
  color:var(--text);
  font-size:13px;
  font-weight:600;
  min-width:0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.assignee-panel{
  max-height:0;
  opacity:0;
  overflow:hidden;
  pointer-events:none;
  transform:translateY(-4px);
  transition:max-height .22s ease, opacity .18s ease, transform .18s ease;
}
.assignee-panel.is-open{
  max-height:16rem;
  opacity:1;
  pointer-events:auto;
  transform:translateY(0);
}
.assignee-item{
  display:flex;
  align-items:center;
  gap:4px;
  font-size:12px;
  user-select:none;
  transition:transform .14s ease, opacity .14s ease;
}
.assignee-item input{accent-color:var(--accent)}
.assignee-item.is-checked{
  transform:translateX(3px);
}
.assignee-item.is-checked input{
  transform:scale(1.08);
}
.product-field{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:10px;
}
.product-family-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:8px;
}
.product-family-btn{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:4px;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#2b3140;
  color:var(--text);
  cursor:pointer;
  text-align:left;
}
.product-family-btn:hover{border-color:#586376}
.product-family-btn.is-selected{
  border-color:var(--accent);
  background:rgba(135,227,255,0.16);
}
.product-family-title{
  font-size:13px;
  font-weight:700;
}
.product-family-meta{
  font-size:11px;
  color:var(--muted);
  line-height:1.4;
}
.product-plan-row{
  display:grid;
  grid-template-columns:minmax(0, 1fr) auto;
  gap:10px;
  align-items:center;
}
.product-plan-note{
  color:var(--muted);
  font-size:12px;
  white-space:nowrap;
}
.product-custom-wrap{
  display:flex;
}
.product-summary{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}
.product-chip{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#2b3140;
  font-size:12px;
}
.product-chip-label{color:var(--muted)}
.product-hidden-select{display:none}
.btn{
  background:var(--accent);
  color:#071017;
  border:none;
  border-radius:10px;
  padding:10px 12px;
  font-weight:700;
  cursor:pointer;
}
.btn:hover{filter:brightness(1.1)}
.btn:active{transform:translateY(1px)}
.btn-ghost{
  background:transparent;
  color:var(--text);
  border:1px solid var(--line);
}
.btn-ghost:hover{border-color:#586376}
.btn-danger{
  color:var(--bad);
  border-color:var(--bad);
}
.btn-danger-ghost{
  color:var(--bad);
  border-color:transparent;
}
.btn-danger-ghost:hover{
  border-color:var(--bad);
  background:rgba(255,107,107,0.08);
}
.delete-confirm{
  display:none;
  gap:.5rem;
  align-items:center;
  padding:.5rem .75rem;
  border-radius:6px;
  background:rgba(255,107,107,0.08);
  border:1px solid var(--bad);
  margin-bottom:.5rem;
  flex-wrap:wrap;
}
.delete-confirm-text{
  flex:1;
  font-size:.85rem;
  color:var(--bad);
}
.btn-danger:hover{
  background:rgba(255,107,107,0.15);
  border-color:var(--bad);
}
.btn-warn{
  background:var(--warn);
  color:#0b0c10;
  border:none;
}
.btn-warn:hover{
  filter:brightness(1.1);
}
.btn-sm{
  padding:6px 10px;
  font-size:12px;
}
.checkbox{display:flex; align-items:center; gap:6px; user-select:none}
.checkbox input{accent-color:var(--accent)}
.checkbox-sm{display:inline-flex; align-items:center; gap:2px; user-select:none; font-size:10px; margin-right:4px}
.checkbox-sm input{accent-color:var(--accent); width:12px; height:12px}
.checkbox-group{display:flex; flex-wrap:wrap; gap:2px 6px}

.toolbar{
  display:flex; align-items:center; justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
}
.toolbar-left{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.toolbar-right{display:flex; align-items:center; gap:10px}
.toolbar input[type="search"]{min-width:260px}
.sort-select{
  background:#2b3140;
  border:1px solid var(--line);
  color:var(--text);
  padding:6px 10px;
  border-radius:8px;
  font-size:12px;
  cursor:pointer;
}
.sort-select:hover{border-color:#586376}
.sort-select:focus{outline:none; border-color:var(--accent)}

/* Grid Container with dual scrollbars */
#appPanel{
  height:100%;
  display:flex;
  flex-direction:column;
  min-height:0;
}
#appPanel .toolbar{
  flex:0 0 auto;
}
.gridContainer{
  position:relative;
  flex:1 1 auto;
  min-height:0;
  display:flex;
  flex-direction:column;
}
.gridScrollTop{
  overflow-x:auto;
  overflow-y:hidden;
  border:1px solid var(--line);
  border-bottom:none;
  border-radius:12px 12px 0 0;
  background:#262d3c;
  height:12px;
}
.gridScrollTopInner{
  height:1px;
}
.gridWrap{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
  border:1px solid var(--line);
  border-radius:0 0 12px 12px;
  background:#262d3c;
}
.gridScrollTop,
.gridWrap,
.ai-summary-content,
.overview-cell .prewrap{
  scrollbar-width:thin;
  scrollbar-color:rgba(93, 214, 255, 0.32) rgba(255, 255, 255, 0.02);
}
.gridScrollTop::-webkit-scrollbar,
.gridWrap::-webkit-scrollbar,
.ai-summary-content::-webkit-scrollbar,
.overview-cell .prewrap::-webkit-scrollbar{
  width:8px;
  height:8px;
}
.gridScrollTop::-webkit-scrollbar-track,
.gridWrap::-webkit-scrollbar-track,
.ai-summary-content::-webkit-scrollbar-track,
.overview-cell .prewrap::-webkit-scrollbar-track{
  background:rgba(255, 255, 255, 0.02);
  border-radius:999px;
}
.gridScrollTop::-webkit-scrollbar-thumb,
.gridWrap::-webkit-scrollbar-thumb,
.ai-summary-content::-webkit-scrollbar-thumb,
.overview-cell .prewrap::-webkit-scrollbar-thumb{
  background:linear-gradient(180deg, rgba(135, 227, 255, 0.56), rgba(135, 227, 255, 0.28));
  border-radius:999px;
}
.gridScrollTop::-webkit-scrollbar-thumb:hover,
.gridWrap::-webkit-scrollbar-thumb:hover,
.ai-summary-content::-webkit-scrollbar-thumb:hover,
.overview-cell .prewrap::-webkit-scrollbar-thumb:hover{
  background:linear-gradient(180deg, rgba(135, 227, 255, 0.78), rgba(135, 227, 255, 0.4));
}
.grid{
  min-width:900px;
}
.grid-table{
  border-collapse:separate;
  border-spacing:0;
  width:max-content;
  min-width:100%;
  font-size:12px;
}
.grid-table th, .grid-table td{
  border-right:1px solid var(--line);
  border-bottom:1px solid var(--line);
  vertical-align:top;
  padding:10px 10px;
  min-width:var(--grid-col-width);
  max-width:var(--grid-col-width);
  font-size:var(--font-base);
}
.grid-table th:first-child,
.grid-table td:first-child{
  position:sticky;
  left:0;
  z-index:2;
  min-width:var(--grid-label-width);
  max-width:var(--grid-label-width);
  background:#171b24;
  white-space:nowrap;
}
.grid-table thead th{
  position:sticky;
  top:0;
  z-index:4;
  background:#1c2230;
  background-image:none;
  box-shadow:0 1px 0 rgba(255,255,255,0.05), 0 8px 18px rgba(0,0,0,0.18);
  isolation:isolate;
  overflow:hidden;
}
.grid-table thead th:first-child{
  z-index:5;
  background:#1c2230;
  box-shadow:1px 0 0 rgba(255,255,255,0.04), 0 1px 0 rgba(255,255,255,0.05), 0 10px 18px rgba(0,0,0,0.2);
}
.grid-table thead th::before{
  content:"";
  position:absolute;
  inset:0;
  background:#1c2230;
  z-index:-1;
}

.cell-title{
  font-weight:700;
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  justify-content:flex-start;
  gap:10px;
}
.cell-title > span:first-child{
  width:100%;
  font-size:var(--font-title);
  line-height:1.5;
  word-break:break-word;
  padding-bottom:4px;
  border-bottom:1px solid rgba(255,255,255,0.08);
}
.cell-title > span:first-child .link{
  display:block;
  width:100%;
}
.header-meta-row{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  width:100%;
  align-items:flex-start;
}
.header-meta-row > *{
  flex:0 1 auto;
}
.badges{display:flex; gap:6px; flex-wrap:wrap}
.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:2px 8px;
  border-radius:999px;
  border:1px solid var(--line);
  font-size:var(--font-small);
  color:var(--muted);
  font-weight:600;
}
.badge.warn{border-color:rgba(255,204,102,.45); color:var(--warn)}
.badge.bad{border-color:rgba(255,107,107,.45); color:var(--bad)}
.badge.good{border-color:rgba(119,255,176,.45); color:var(--good)}

/* ステータスバッジ */
.badge.status-active{border-color:rgba(135,227,255,.45); color:var(--accent); background:rgba(135,227,255,.1)}
.badge.status-hold{border-color:rgba(255,217,122,.45); color:var(--warn); background:rgba(255,217,122,.1)}
.badge.status-stop{border-color:rgba(174,183,198,.45); color:var(--muted); background:rgba(174,183,198,.1)}
.badge.status-won{border-color:rgba(146,255,193,.45); color:var(--good); background:rgba(146,255,193,.1)}
.badge.status-lost{border-color:rgba(255,131,131,.45); color:var(--bad); background:rgba(255,131,131,.1)}
.badge.status-nta{border-color:rgba(206,177,236,.45); color:#d3b3ef; background:rgba(206,177,236,.1)}
.badge.badge-progress{
  border-color:rgba(135,227,255,.45);
  color:var(--accent);
  background:rgba(135,227,255,.08);
  white-space:nowrap;
}

.small{font-size:var(--font-small)}
.prewrap{white-space:pre-wrap}
.truncate{
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.sep{height:8px}
.inline-actions{display:flex; gap:6px; margin-top:8px; flex-wrap:wrap}
.inline-actions .btn{padding:4px 8px; font-size:var(--font-button)}
.inline-actions .btn-ghost{padding:4px 8px; font-size:var(--font-button)}

.report-form{
  border:1px solid var(--line);
  border-radius:8px;
  padding:6px;
  background:#1b2230;
}
.report-form .row{margin:4px 0}
.report-form label{width:50px; font-size:10px}
.report-form input, .report-form textarea, .report-form select{padding:5px; font-size:11px}
.report-form textarea{min-height:40px}

.star{
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.star input{display:none}
.star label{
  cursor:pointer;
  font-size:16px;
  color:#52607a;
  padding:0 2px;
}
.star input:checked ~ label{color:#62708b}
.star label.selected{color:var(--warn)}

.dialog{
  border:1px solid var(--line);
  border-radius:14px;
  padding:0;
  width:min(720px, 95vw);
  background:#262d3c;
  color:var(--text);
}
.project-dialog-form{
  display:flex;
  flex-direction:column;
  gap:12px;
  font-size:var(--font-base);
}
.project-dialog-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
}
#projectDialog{
  width:min(920px, 95vw);
  max-height:90vh;
  overflow-y:auto;
  scrollbar-width:thin;
  scrollbar-color:rgba(93, 214, 255, 0.32) rgba(255, 255, 255, 0.02);
}
#projectDialog::-webkit-scrollbar{
  width:8px;
}
#projectDialog::-webkit-scrollbar-track{
  background:rgba(255, 255, 255, 0.02);
  border-radius:999px;
}
#projectDialog::-webkit-scrollbar-thumb{
  background:linear-gradient(180deg, rgba(93, 214, 255, 0.52), rgba(93, 214, 255, 0.24));
  border-radius:999px;
}
#projectDialog::-webkit-scrollbar-thumb:hover{
  background:linear-gradient(180deg, rgba(93, 214, 255, 0.72), rgba(93, 214, 255, 0.36));
}
#reportDialog{
  width:min(920px, 95vw);
  max-height:90vh;
  overflow-y:auto;
  scrollbar-width:thin;
  scrollbar-color:rgba(93, 214, 255, 0.32) rgba(255, 255, 255, 0.02);
}
#reportDialog::-webkit-scrollbar{
  width:8px;
}
#reportDialog::-webkit-scrollbar-track{
  background:rgba(255, 255, 255, 0.02);
  border-radius:999px;
}
#reportDialog::-webkit-scrollbar-thumb{
  background:linear-gradient(180deg, rgba(93, 214, 255, 0.52), rgba(93, 214, 255, 0.24));
  border-radius:999px;
}
#reportDialog::-webkit-scrollbar-thumb:hover{
  background:linear-gradient(180deg, rgba(93, 214, 255, 0.72), rgba(93, 214, 255, 0.36));
}
.dialog-wide{
  width:min(800px, 95vw);
  max-height:90vh;
  overflow-y:auto;
}

.org-admin-hero{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.org-admin-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}

.org-admin-actions{
  display:flex;
  align-items:flex-start;
  justify-content:flex-end;
  gap:10px;
  flex-wrap:wrap;
}

.org-admin-tabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.org-admin-tab{
  min-width:120px;
}

.org-admin-tab.is-active{
  background:rgba(135,227,255,0.15);
  border-color:var(--accent);
}

.org-admin-layout{
  display:grid;
  grid-template-columns:minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap:16px;
}

.org-admin-layout.is-single{
  grid-template-columns:1fr;
}

.org-admin-tree-actions{
  margin-top:10px;
  display:flex;
  justify-content:flex-start;
}

.org-admin-panel{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.mockup-org-panel{
  background:#2a3040;
}

.org-admin-panel[hidden]{
  display:none !important;
}

.org-admin-section-title{
  margin:0;
  color:var(--muted);
  font-size:var(--font-title);
  font-weight:700;
  letter-spacing:0.08em;
}

.org-admin-summary{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:6px;
}

.org-admin-toolbar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

.mockup-org-grid{
  display:grid;
  grid-template-columns:1.1fr 0.9fr;
  gap:16px;
}

.mockup-org-grid-two{
  grid-template-columns:1.25fr 0.75fr;
}

.mockup-org-panel{
  display:flex;
  flex-direction:column;
  gap:12px;
  background:#1a1f2a;
  border:1px solid var(--line);
  border-radius:12px;
  padding:14px;
}

.mockup-org-panel h4{
  margin:0;
  font-size:var(--font-title);
}

.mockup-org-form{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.mockup-org-users-head{
  display:flex;
  flex-direction:column;
  gap:4px;
}

.mockup-org-mini-note,
.mockup-org-inline-note{
  color:var(--muted);
  font-size:var(--font-small);
  line-height:1.5;
}

.mockup-org-tree{
  list-style:none;
  margin:0;
  padding:0;
  display:grid;
  gap:8px;
}

.mockup-org-tree-children{
  margin-top:8px;
  margin-left:16px;
}

.mockup-org-tree-item{
  padding:10px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#2b3140;
  cursor:pointer;
}

.mockup-org-tree-item.is-selected{
  border-color:var(--accent);
  background:rgba(135,227,255,0.11);
}

.user-list{
  display:grid;
  gap:8px;
}

.user-list-item{
  width:100%;
  text-align:left;
  border:1px solid var(--line);
  border-radius:12px;
  background:#2b3140;
  padding:10px 12px;
  color:var(--text);
  cursor:pointer;
}

.user-list-item.is-selected{
  border-color:var(--accent);
  background:rgba(135,227,255,0.11);
}

.user-list-item:hover{
  border-color:#586376;
}

.user-detail-empty{
  min-height:180px;
  display:flex;
  align-items:center;
  justify-content:center;
  border:1px dashed var(--line);
  border-radius:12px;
  color:var(--muted);
  background:rgba(255,255,255,0.02);
}

.mockup-org-tree-item:hover{
  border-color:#586376;
}

.mockup-org-tree-item.is-root{
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.03);
}

.mockup-org-node-meta{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:8px;
}

.mockup-org-node-users{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin-top:8px;
}

.mockup-org-node-user,
.mockup-org-tag,
.mockup-org-manager-item{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:4px 10px;
  border-radius:999px;
  border:1px solid var(--line);
  background:#2b3140;
  font-size:var(--font-small);
}

.mockup-org-tag.manager{
  border-color:rgba(135,227,255,0.45);
}

.mockup-org-code{
  color:var(--muted);
  font-size:var(--font-small);
}

.mockup-org-manager-list{
  display:grid;
  gap:8px;
}

.mockup-org-manager-item{
  justify-content:space-between;
}

.org-admin-panel .kpiTable{
  margin-top:8px;
}

@media (max-width: 1024px){
  .org-admin-layout{
    grid-template-columns:1fr;
  }
  .mockup-org-grid{
    grid-template-columns:1fr;
  }
}
#orgMgmtDialog{
  width:min(1320px, 96vw);
  max-height:92vh;
  overflow-y:auto;
}
.dialog::backdrop{background:rgba(0,0,0,.55)}
.dialog-form{padding:14px}
.project-dialog-form h3{
  margin:0 0 2px;
  font-size:var(--font-title);
  letter-spacing:0.01em;
}
.project-dialog-close{
  flex:0 0 auto;
  min-width:36px;
  min-height:36px;
  padding:0;
  font-size:18px;
  line-height:1;
  border-radius:999px;
}
.project-dialog-form .project-section{
  border:1px solid rgba(255,255,255,0.07);
  border-radius:14px;
  background:linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  padding:12px 12px 10px;
  box-shadow:inset 0 1px 0 rgba(255,255,255,0.03);
}
.project-dialog-form .project-section-title{
  margin:0 0 10px;
  color:var(--muted);
  font-size:var(--font-base);
  font-weight:700;
  letter-spacing:0.12em;
}
.project-dialog-form .row{
  margin:0;
  padding:8px 0;
  display:grid;
  grid-template-columns:136px minmax(0, 1fr) auto;
  gap:10px;
  align-items:center;
}
.project-dialog-form .row + .row{
  border-top:1px solid rgba(255,255,255,0.04);
}
.project-dialog-form .row label{
  width:auto;
  min-width:0;
  color:var(--muted);
  font-size:var(--font-base);
  line-height:1.35;
}
.project-dialog-form .row > input,
.project-dialog-form .row > select,
.project-dialog-form .row > textarea{
  min-width:0;
  width:100%;
}
.project-dialog-form .row > .product-field,
.project-dialog-form .row > .assignee-compact{
  min-width:0;
  grid-column:2 / -1;
}
.project-dialog-form .row > .checkbox{
  grid-column:2 / -1;
  justify-self:start;
}
.project-dialog-form .row > .checkbox{
  margin:0;
}
.project-dialog-form .product-field,
.project-dialog-form .assignee-compact{
  width:100%;
}
.project-dialog-form .product-family-grid{
  grid-template-columns:repeat(3, minmax(0, 1fr));
}
.project-dialog-form .product-plan-row{
  grid-template-columns:minmax(0, 1fr);
}
.project-dialog-form .product-plan-note{
  white-space:normal;
  line-height:1.45;
  font-size:var(--font-base);
}
.project-dialog-form .product-summary{
  padding-top:2px;
}
.project-dialog-form .product-family-btn{
  padding:12px 14px;
  min-height:72px;
}
.project-dialog-form .product-family-title{
  font-size:var(--font-base);
}
.project-dialog-form .product-family-meta{
  font-size:var(--font-small);
}
.project-dialog-form .assignee-compact-bar{
  padding:2px 0 0;
}
.project-dialog-form .assignee-summary{
  font-size:var(--font-base);
}
.project-dialog-form .assignee-panel{
  margin-top:2px;
}
.project-dialog-form .dialog-actions{
  position:sticky;
  bottom:0;
  z-index:2;
  margin-top:4px;
  padding:12px 0 2px;
  background:linear-gradient(180deg, rgba(23,27,36,0), rgba(23,27,36,0.94) 28%, rgba(23,27,36,0.98));
  border-top:1px solid rgba(255,255,255,0.08);
  backdrop-filter:blur(10px);
}
.project-dialog-form .row input,
.project-dialog-form .row select,
.project-dialog-form .row textarea{
  font-size:var(--font-base);
}
.project-dialog-form .product-chip,
.project-dialog-form .btn,
.project-dialog-form .btn-ghost{
  font-size:var(--font-base);
}
.project-dialog-form .btn-sm{
  font-size:var(--font-base);
  padding:8px 12px;
}
.project-dialog-form .dialog-actions .btn,
.project-dialog-form .dialog-actions .btn-ghost{
  min-width:92px;
}

.report-dialog-form .report-chip-group{
  gap:8px;
}
.report-dialog-form .report-chip-group .checkbox-sm{
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin-right:0;
  padding:7px 11px;
  border:1px solid rgba(255,255,255,0.08);
  border-radius:999px;
  background:rgba(255,255,255,0.03);
  color:var(--text);
  font-size:var(--font-base);
}
.report-dialog-form .report-chip-group .checkbox-sm input{
  width:14px;
  height:14px;
}
.report-dialog-form .report-textarea-row{
  display:block;
  grid-column:2 / -1;
  width:100%;
  min-width:0;
}
.report-dialog-form .report-textarea-row textarea{
  display:block;
  width:100%;
  min-height:110px;
  resize:vertical;
}
.report-dialog-form .report-upload-area{
  align-items:flex-start;
  gap:8px 10px;
  flex-wrap:wrap;
}
.report-dialog-form .report-files-wrap{
  display:flex;
  flex-direction:column;
  gap:8px;
  width:100%;
}
.report-dialog-form .report-upload-help{
  display:block;
  flex-basis:100%;
  margin-top:2px;
}
.report-dialog-form .report-upload-area .muted.small{
  max-width:100%;
}

/* Flatpickr in dialog - static mode styling */
.dialog-form .flatpickr-wrapper{
  display: block;
  width: 100%;
}
.dialog-form .flatpickr-input{
  width: 100%;
}
.dialog-form .flatpickr-calendar.static{
  position: relative !important;
  top: auto !important;
  left: auto !important;
  margin-top: 4px;
}

/* Report summary in grid cell */
.report-summary{
  font-size:12px;
  line-height:1.5;
}
.dialog-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:12px;
}
.company-list{
  margin-top:12px;
  padding-top:8px;
  border-top:1px solid var(--line);
}
.company-list-header{
  font-size:12px;
  margin-bottom:6px;
}
.company-list-header-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:8px;
}
.company-search-input{
  flex:0 1 200px;
  background:#2b3140;
  border:1px solid var(--line);
  color:var(--text);
  border-radius:8px;
  padding:6px 10px;
  font-size:12px;
}
.company-search-input:focus{
  outline:none;
  border-color:var(--accent);
}
.company-search-input::placeholder{
  color:var(--muted);
}
.company-table-wrap{
  border:1px solid var(--line);
  border-radius:10px;
  overflow:auto;
  max-height:240px;
}
.company-table{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}
.company-table th,
.company-table td{
  border-bottom:1px solid var(--line);
  padding:6px 8px;
  text-align:left;
  vertical-align:top;
}
.company-table thead th{
  position:sticky;
  top:0;
  background:#181d27;
  z-index:1;
}
.company-table tbody tr:last-child td{
  border-bottom:none;
}
.company-table .company-actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}
.historyBody{max-height:60vh; overflow:auto; border:1px solid var(--line); border-radius:12px; padding:10px; background:#0c0e14}
.hr{height:1px; background:var(--line); margin:10px 0}

/* Action Text Dialog */
.action-text-body{
  border:1px solid var(--line);
  border-radius:12px;
  padding:14px;
  background:#0c0e14;
  max-height:60vh;
  overflow-y:auto;
}
.action-text-header{
  margin-bottom:12px;
  padding-bottom:12px;
  border-bottom:1px solid var(--line);
}
.action-text-content{
  white-space:pre-wrap;
  line-height:1.7;
  font-size:14px;
}

.kpiTable table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}
.kpiTable th, .kpiTable td{
  border-bottom:1px solid var(--line);
  padding:10px 8px;
  text-align:left;
}
.kpiTable th{color:var(--muted); font-size:12px}
.kpiTableWide{
  overflow-x:auto;
}
.kpiTableWide table{
  min-width:max-content;
}
.kpiTableWide th, .kpiTableWide td{
  min-width:70px;
  text-align:center;
}
.kpiTableWide th:first-child, .kpiTableWide td:first-child{
  text-align:left;
  position:sticky;
  left:0;
  background:var(--card);
  z-index:1;
}
.footnote{margin-top:10px}

/* Flatpickr customization for dark theme */
.flatpickr-calendar{
  background:var(--card) !important;
  border:1px solid var(--line) !important;
  border-radius:12px !important;
  box-shadow:0 4px 20px rgba(0,0,0,0.4) !important;
}
.flatpickr-calendar.arrowTop:before,
.flatpickr-calendar.arrowTop:after{
  border-bottom-color:var(--line) !important;
}
.flatpickr-months .flatpickr-month{
  background:transparent !important;
  color:var(--text) !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year{
  color:var(--text) !important;
}
.flatpickr-weekdays{
  background:transparent !important;
}
span.flatpickr-weekday{
  color:var(--muted) !important;
}
.flatpickr-day{
  color:var(--text) !important;
  border-radius:8px !important;
}
.flatpickr-day:hover{
  background:var(--line) !important;
  border-color:var(--line) !important;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover{
  background:var(--accent) !important;
  border-color:var(--accent) !important;
  color:#071017 !important;
}
.flatpickr-day.today{
  border-color:var(--accent) !important;
}
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay{
  color:var(--muted) !important;
}
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month{
  fill:var(--text) !important;
  color:var(--text) !important;
}
.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg{
  fill:var(--accent) !important;
}
.numInputWrapper span{
  border-color:var(--line) !important;
}
.numInputWrapper span:hover{
  background:var(--line) !important;
}
.numInputWrapper span svg path{
  fill:var(--muted) !important;
}

/* Company/Product/Amount combined cell */
.company-info-compact{
  display:flex;
  flex-direction:column;
  gap:4px;
  line-height:1.45;
}
.company-info-name{
  font-size:var(--font-base);
  font-weight:700;
  min-width:0;
  word-break:break-word;
}
.company-info-plan{
  font-size:var(--font-small);
  color:var(--muted);
  word-break:break-word;
}
.company-info-amount{
  align-self:flex-start;
  padding:4px 10px;
  border:1px solid rgba(255,255,255,0.09);
  border-radius:10px;
  background:rgba(255,255,255,0.035);
  font-size:var(--font-base);
  font-weight:700;
}
.company-info-agency{
  font-size:var(--font-small);
  color:var(--muted);
  line-height:1.35;
  word-break:break-word;
}
.company-info-due{
  font-size:var(--font-small);
  color:var(--muted);
  line-height:1.35;
}

/* AI Next Task display */
.next-task{
  font-size:var(--font-muted);
  line-height:1.65;
  padding:8px 10px;
  background:rgba(93,214,255,0.14);
  border-left:3px solid var(--accent);
  border-radius:0 4px 4px 0;
}
.next-task-due{
  font-weight:700;
  color:var(--accent);
  margin-right:6px;
}

.ai-priority-block{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-bottom:12px;
}
.ai-section-label{
  display:inline-block;
  margin:0 0 6px;
  padding:3px 9px;
  border-radius:999px;
  font-size:var(--font-small);
  font-weight:700;
  letter-spacing:.01em;
}
.ai-section-label-advice{
  background:rgba(255,206,84,.14);
  color:#ffe08a;
}
.ai-section-label-task{
  background:rgba(93,214,255,.14);
  color:#b9ecff;
}
.ai-section-label-summary{
  background:rgba(255,255,255,.08);
  color:#d7deea;
}
.ai-advice-box{
  padding:10px 12px;
  border-radius:10px;
  background:rgba(255,206,84,.08);
  border:1px solid rgba(255,206,84,.16);
  line-height:1.75;
}
.ai-summary-content{
  max-height:min(18vh, 10rem);
  overflow:auto;
  background:rgba(255,255,255,.02);
  border:1px solid rgba(255,255,255,.06);
  border-radius:10px;
  padding:12px;
}
.ai-summary-block.is-expanded .ai-summary-content{
  max-height:none;
}
.ai-summary-content .prewrap{
  line-height:1.75;
}
.ai-summary-expand-btn{
  margin-top:8px;
}

.overview-cell .overview-content{
  max-height:min(28vh, 16rem);
  overflow:hidden;
}
.overview-cell.is-expanded .overview-content{
  max-height:none;
}
.overview-content .prewrap{
  line-height:1.7;
}
.overview-expand-btn{
  margin-top:8px;
}

.row-toggle-btn{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  background:transparent;
  border:1px solid var(--line);
  color:var(--text);
  border-radius:999px;
  padding:.2rem .55rem;
  font-size:var(--font-small);
  cursor:pointer;
}
.row-toggle-btn:hover{
  border-color:var(--accent);
  color:var(--accent);
}
.grid-table tr.is-collapsed td:not(:first-child){
  position:relative;
  min-height:44px;
}
.grid-table tr.is-collapsed td:not(:first-child) > *{
  display:none !important;
}
.grid-table tr.is-collapsed td:not(:first-child)::before{
  content:"折りたたみ中";
  color:var(--muted);
  font-size:var(--font-small);
}

/* AI Bullets list */
.ai-bullets{
  margin:4px 0 0 0;
  padding-left:16px;
  font-size:11px;
  line-height:1.5;
}
.ai-bullets li{
  margin-bottom:4px;
}

/* No report warning - warm color highlight */
.grid-table th.no-report,
.grid-table td.no-report{
  background:rgba(255,140,60,0.12) !important;
  border-color:rgba(255,140,60,0.3) !important;
}
.grid-table th.no-report{
  border-bottom:2px solid rgba(255,140,60,0.5) !important;
}

/* AI generating indicator */
.ai-generating-indicator{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  margin-bottom:8px;
  background:rgba(93,214,255,0.1);
  border:1px solid rgba(93,214,255,0.3);
  border-radius:8px;
  font-size:12px;
  color:var(--accent);
}
.ai-spinner{
  display:inline-block;
  width:14px;
  height:14px;
  border:2px solid rgba(93,214,255,0.3);
  border-top-color:var(--accent);
  border-radius:50%;
  animation:spin 0.8s linear infinite;
}
@keyframes spin{
  to{transform:rotate(360deg)}
}

/* Password field with toggle button */
.password-field{
  display:flex;
  align-items:center;
  gap:8px;
  flex:1;
}
.password-field input{
  flex:1;
}
.btn-toggle-password{
  background:transparent;
  border:1px solid var(--line);
  border-radius:6px;
  padding:6px 10px;
  cursor:pointer;
  font-size:14px;
  color:var(--muted);
  transition:all 0.2s;
}
.btn-toggle-password:hover{
  background:var(--line);
  color:var(--text);
}
.btn-toggle-password.active{
  background:rgba(93,214,255,0.2);
  border-color:var(--accent);
  color:var(--accent);
}

/* User Filter Dropdown */
.user-filter-wrap{
  position:relative;
}
.user-filter-btn{
  min-width:100px;
}
.user-filter-dropdown{
  position:absolute;
  top:100%;
  left:0;
  margin-top:4px;
  min-width:220px;
  max-height:300px;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:10px;
  box-shadow:0 4px 20px rgba(0,0,0,0.3);
  z-index:100;
  overflow:hidden;
}
.user-filter-header{
  display:flex;
  gap:8px;
  padding:8px;
  border-bottom:1px solid var(--line);
  background:#171b24;
}
.user-filter-list{
  max-height:240px;
  overflow-y:auto;
  padding:8px;
}
.user-filter-item{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 8px;
  border-radius:6px;
  cursor:pointer;
  transition:background 0.15s;
}
.user-filter-item:hover{
  background:var(--line);
}
.user-filter-item input{
  accent-color:var(--accent);
}
.user-filter-item label{
  flex:1;
  cursor:pointer;
  font-size:13px;
}

/* Status Filter Dropdown */
.status-filter-wrap{
  position:relative;
}
.status-filter-btn{
  min-width:120px;
}
.status-filter-dropdown{
  position:absolute;
  top:100%;
  left:0;
  margin-top:4px;
  min-width:180px;
  background:var(--card);
  border:1px solid var(--line);
  border-radius:10px;
  box-shadow:0 4px 20px rgba(0,0,0,0.3);
  z-index:100;
  overflow:hidden;
}
.status-filter-header{
  display:flex;
  gap:8px;
  padding:8px;
  border-bottom:1px solid var(--line);
  background:#171b24;
}
.status-filter-list{
  padding:8px;
}
.status-filter-item{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 8px;
  border-radius:6px;
  cursor:pointer;
  transition:background 0.15s;
}
.status-filter-item:hover{
  background:var(--line);
}
.status-filter-item input{
  accent-color:var(--accent);
}
.status-filter-item label{
  flex:1;
  cursor:pointer;
  font-size:13px;
}

/* Tooltip styles */
.label-with-tooltip{
  display:flex;
  align-items:center;
  gap:4px;
}
.tooltip-icon{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:16px;
  height:16px;
  background:var(--line);
  color:var(--muted);
  border-radius:50%;
  font-size:10px;
  font-weight:700;
  cursor:help;
  position:relative;
}
.tooltip-icon:hover{
  background:var(--accent);
  color:#071017;
}
.tooltip-icon::after{
  content:attr(data-tooltip);
  position:absolute;
  left:0;
  bottom:calc(100% + 8px);
  transform:translateX(0);
  background:#1a1d26;
  color:var(--text);
  padding:10px 12px;
  border-radius:8px;
  font-size:12px;
  font-weight:400;
  line-height:1.5;
  white-space:normal;
  width:280px;
  max-width:90vw;
  box-shadow:0 4px 16px rgba(0,0,0,0.4);
  border:1px solid var(--line);
  opacity:0;
  visibility:hidden;
  transition:opacity 0.2s, visibility 0.2s;
  z-index:1000;
  pointer-events:none;
}
.tooltip-icon::before{
  content:"";
  position:absolute;
  left:4px;
  bottom:calc(100% + 2px);
  transform:translateX(0);
  border:6px solid transparent;
  border-top-color:#1a1d26;
  opacity:0;
  visibility:hidden;
  transition:opacity 0.2s, visibility 0.2s;
  z-index:1001;
}
.tooltip-icon:hover::after,
.tooltip-icon:hover::before{
  opacity:1;
  visibility:visible;
}

/* Voice input button */
.textarea-with-voice{
  display:flex;
  gap:8px;
  flex:1;
  align-items:flex-start;
}
.textarea-with-voice textarea{
  flex:1;
}
.btn-voice{
  background:var(--line);
  border:1px solid var(--line);
  border-radius:8px;
  padding:8px 10px;
  font-size:16px;
  cursor:pointer;
  transition:all 0.2s;
  flex-shrink:0;
}
.btn-voice:hover{
  background:var(--accent);
  border-color:var(--accent);
}
.btn-voice.recording{
  background:var(--bad);
  border-color:var(--bad);
  animation:pulse 1s infinite;
}
@keyframes pulse{
  0%, 100%{ opacity:1; }
  50%{ opacity:0.6; }
}

/* Win Probability - 受注可能性表示 */
.win-probability{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:4px 8px;
  margin-bottom:6px;
  border-radius:6px;
  font-size:11px;
  font-weight:600;
}
.win-probability .prob-value{
  font-size:13px;
  font-weight:700;
}
.win-probability.prob-high{
  background:linear-gradient(135deg, rgba(119,255,176,0.2), rgba(93,214,255,0.15));
  border:1px solid rgba(119,255,176,0.4);
  color:var(--good);
}
.win-probability.prob-mid{
  background:linear-gradient(135deg, rgba(255,204,102,0.2), rgba(255,180,60,0.15));
  border:1px solid rgba(255,204,102,0.4);
  color:var(--warn);
}
.win-probability.prob-low{
  background:linear-gradient(135deg, rgba(255,107,107,0.2), rgba(255,80,80,0.15));
  border:1px solid rgba(255,107,107,0.4);
  color:var(--bad);
}

/* PDF Upload and Attachment Styles */
.pdf-upload-area{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.pdf-file-input{
  display:none;
}
.attachments-list{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:8px;
}
.attachment-item{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:4px 8px;
  background:var(--bg-secondary);
  border:1px solid var(--border);
  border-radius:6px;
  font-size:12px;
}
.attachment-link{
  display:inline-flex;
  align-items:center;
  gap:4px;
  color:var(--text);
  text-decoration:none;
}
.attachment-link:hover{
  color:var(--accent);
}
.pdf-icon{
  font-size:14px;
}
.attachment-name{
  max-width:150px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.btn-delete-attachment{
  background:none;
  border:none;
  color:var(--bad);
  cursor:pointer;
  font-size:14px;
  padding:0 4px;
  line-height:1;
}
.btn-delete-attachment:hover{
  color:#ff4444;
}

/* PDF Links in grid/list */
.pdf-links{
  display:inline-flex;
  gap:4px;
  margin-left:4px;
}
.pdf-link-small{
  font-size:12px;
  text-decoration:none;
  opacity:0.8;
}
.pdf-link-small:hover{
  opacity:1;
}

/* AI Status Message */
.ai-status-msg{
  font-size:12px;
  margin-left:8px;
}
.ai-status-msg.ai-loading{
  color:var(--accent);
  animation:pulse 1.5s infinite;
}
.ai-status-msg.ai-error{
  color:var(--bad);
}

/* AI Previous Week Notice */
.ai-previous-week-notice{
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
  padding:6px 10px;
  margin-bottom:8px;
  background:rgba(255,204,102,0.1);
  border:1px solid rgba(255,204,102,0.3);
  border-radius:6px;
}

/* KPI Table Highlight Row - 受注確率50%以上 */
.kpi-highlight-row{
  background:rgba(119,255,176,0.08);
}
.kpi-highlight-row td:first-child{
  font-weight:700;
  color:var(--good);
}
.kpi-highlight-cell{
  font-weight:700;
  color:var(--good);
  background:rgba(119,255,176,0.15);
}

/* AI History Dialog */
.ai-history-body{
  max-height:60vh;
  overflow-y:auto;
}
.ai-history-item{
  margin-bottom:12px;
}
.ai-history-header{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:8px;
}
.ai-history-section{
  margin:6px 0;
}
.win-probability-small{
  font-size:11px;
  font-weight:600;
  padding:2px 6px;
  border-radius:4px;
}
.win-probability-small.prob-high{
  background:rgba(119,255,176,0.2);
  color:var(--good);
}
.win-probability-small.prob-mid{
  background:rgba(255,204,102,0.2);
  color:var(--warn);
}
.win-probability-small.prob-low{
  background:rgba(255,107,107,0.2);
  color:var(--bad);
}

/* KPI Status Expandable Section */
.kpi-expandable-header{
  background:rgba(114,137,218,0.1);
  border-top:1px solid rgba(114,137,218,0.3);
}
.kpi-expandable-header td{
  padding:6px 8px;
}
.btn-expand{
  background:transparent;
  border:1px solid rgba(114,137,218,0.5);
  color:var(--text);
  padding:4px 10px;
  border-radius:4px;
  cursor:pointer;
  font-size:12px;
  display:inline-flex;
  align-items:center;
  gap:6px;
  transition:background 0.15s, border-color 0.15s;
}
.btn-expand:hover{
  background:rgba(114,137,218,0.2);
  border-color:rgba(114,137,218,0.8);
}
.expand-icon{
  font-weight:700;
  font-size:14px;
}
.kpi-status-row{
  background:rgba(114,137,218,0.05);
}
.kpi-status-row td{
  padding:4px 8px;
  font-size:12px;
  color:var(--muted);
}
.kpi-status-row .status-label{
  color:var(--text);
  font-size:11px;
}
/* ── 管理者KPI タブ ────────────────────────────────── */
.admin-tabs{
  display:flex;
  gap:4px;
  border-bottom:1px solid var(--line);
  margin-top:16px;
  margin-bottom:16px;
}
.admin-tab{
  padding:8px 16px;
  font-size:13px;
  background:none;
  border:none;
  border-bottom:2px solid transparent;
  color:var(--muted);
  cursor:pointer;
  border-radius:0;
}
.admin-tab:hover{color:var(--text);}
.admin-tab.is-active{
  color:var(--accent);
  border-bottom-color:var(--accent);
}
.tab-panel{display:block;}
.tab-panel.is-hidden{display:none;}

/* ── 月間KPIテーブル ───────────────────────────────── */
.monthly-kpi-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom:10px;
}
.monthly-kpi-period{
  font-size:14px;
  font-weight:400;
  color:var(--muted);
  margin-left:8px;
}
.monthly-kpi-controls{
  display:flex;
  align-items:center;
  gap:8px;
}
.weekly-month-select,
.monthly-year-select,
.monthly-quarter-select{
  background:#2b3140;
  border:1px solid var(--line);
  color:var(--text);
  padding:5px 10px;
  border-radius:8px;
  font-size:13px;
  cursor:pointer;
}
.monthly-year-select:focus,
.monthly-quarter-select:focus{outline:none;border-color:var(--accent);}
.monthly-kpi-note{
  font-size:12px;
  color:var(--muted);
  background:rgba(255,255,255,0.04);
  border-left:3px solid rgba(93,214,255,0.3);
  padding:6px 10px;
  border-radius:0 4px 4px 0;
  margin-bottom:14px;
}
.monthly-kpi-table-wrap{overflow-x:auto;}
.monthly-kpi-table{
  width:100%;
  border-collapse:collapse;
  font-size:13px;
}
.monthly-kpi-table th,
.monthly-kpi-table td{
  padding:7px 12px;
  border:1px solid var(--line);
  text-align:right;
  white-space:nowrap;
}
.monthly-kpi-table thead th{
  background:rgba(93,214,255,0.08);
  color:var(--accent);
  font-size:12px;
  text-align:center;
}
.col-channel{width:60px;}
.col-item{width:200px;text-align:left !important;}
.col-month{min-width:120px;}
.col-total{min-width:130px;}
.channel-cell{
  text-align:center;
  font-weight:700;
  background:rgba(93,214,255,0.06);
  vertical-align:middle;
  border-right:2px solid rgba(93,214,255,0.25);
}
.channel-total{background:rgba(93,214,255,0.12);}
.channel-separator td{border-top:2px solid rgba(93,214,255,0.2);}
.monthly-kpi-table td.item-cell{
  text-align:left;
  color:var(--muted);
  font-size:12px;
  padding-left:10px;
}
.item-actual{color:var(--text);font-weight:600;}
.num-cell{font-variant-numeric:tabular-nums;}
.total-cell{font-weight:700;background:rgba(255,255,255,0.03);}
.target-cell{color:var(--muted);}
.diff-pos{color:#4caf82;}
.diff-neg{color:#ff6b6b;}
.monthly-kpi-table tr.risk-row td{background:rgba(255,107,107,0.05);}
.monthly-kpi-table tr.risk-section-start td{border-top:2px solid rgba(255,107,107,0.35);}
.monthly-kpi-table td.risk-item-cell{color:#ff8a80;}
.monthly-kpi-table td.risk-num-cell{color:#ff6b6b;font-weight:600;}
.monthly-kpi-table td.risk-total-cell{color:#ff6b6b;font-weight:700;background:rgba(255,107,107,0.12);}

/* ── ドリルダウン インラインパネル ─────────────────── */
.drill-panel{display:none;margin-top:16px;border:1px solid rgba(93,214,255,0.25);border-radius:10px;background:rgba(93,214,255,0.04);overflow:hidden;}
.drill-panel.is-open{display:block;}
.drill-panel-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;border-bottom:1px solid rgba(93,214,255,0.15);background:rgba(93,214,255,0.06);}
.drill-panel-title{font-size:14px;font-weight:700;}
.drill-panel-subtitle{font-size:12px;color:var(--muted);margin-top:2px;}
.drill-panel-close{background:none;border:none;color:var(--muted);font-size:18px;cursor:pointer;padding:2px 8px;line-height:1;}
.drill-panel-close:hover{color:var(--text);}
.drill-panel-body{padding:14px 16px;}
.drill-mode-toggle{display:flex;gap:6px;margin-bottom:12px;}
.drill-mode-btn{padding:5px 14px;font-size:12px;border:1px solid var(--line);border-radius:6px;background:none;color:var(--muted);cursor:pointer;}
.drill-mode-btn.is-active{background:rgba(93,214,255,0.12);border-color:var(--accent);color:var(--accent);}
.drill-table{width:100%;border-collapse:collapse;font-size:13px;}
.drill-table th,.drill-table td{padding:6px 12px;border:1px solid var(--line);text-align:right;white-space:nowrap;}
.drill-table th{background:rgba(93,214,255,0.08);color:var(--accent);font-size:12px;}
.drill-table th:first-child,.drill-table td:first-child{text-align:left;white-space:normal;max-width:280px;}
.drill-table tr.total-row td{font-weight:700;background:rgba(93,214,255,0.06);}
.num-cell.is-clickable{cursor:pointer;text-decoration:underline;text-decoration-style:dotted;text-underline-offset:3px;}
.num-cell.is-clickable:hover{color:var(--accent);}
.drill-view-hidden{display:none;}
.drill-project-link{color:var(--accent);text-decoration:none;}
.drill-project-link:hover{text-decoration:underline;opacity:.85;}
.drill-project-filter{display:flex;align-items:center;gap:8px;margin-bottom:10px;}

/* ── レポートタブ プレースホルダー ─────────────────── */
.report-placeholder{
  padding:60px 0;
  text-align:center;
  color:var(--muted);
  font-size:14px;
}
.report-placeholder-icon{
  font-size:32px;
  margin-bottom:12px;
}

/* ── 週間レポート ────────────────────────────────────── */
.report-summary-bar{
  display:flex;
  gap:20px;
  flex-wrap:wrap;
  padding:10px 0 6px;
  border-top:1px solid var(--line);
  margin-top:8px;
}
.report-summary-stat{font-size:13px;color:var(--muted);}
.report-summary-stat strong{font-size:15px;font-weight:700;margin-left:4px;color:var(--text);}
.report-summary-stat.ok strong{color:#4caf50;}
.report-summary-stat.warn strong{color:#ff9800;}
.report-summary-stat.risk strong{color:#ff6b6b;}

.report-channel-section{
  margin-top:16px;
  margin-bottom:20px;
  border:1px solid var(--line);
  border-radius:10px;
  overflow:hidden;
}
.report-channel-header{
  display:flex;
  align-items:center;
  gap:12px;
  padding:10px 16px;
  background:rgba(93,214,255,0.05);
  border-bottom:2px solid rgba(93,214,255,0.2);
}
.report-channel-name{font-size:15px;font-weight:700;color:var(--accent);}
.report-channel-stats{font-size:12px;color:var(--muted);}
.report-channel-body{padding:12px;display:flex;flex-direction:column;gap:12px;}
.report-channel-body>.card{margin:0;}

.report-section-title{
  font-size:12px;
  font-weight:700;
  letter-spacing:.05em;
  color:var(--muted);
  text-transform:uppercase;
  margin-bottom:10px;
  padding-bottom:6px;
  border-bottom:1px solid var(--line);
}

.report-report-table{width:100%;border-collapse:collapse;font-size:13px;}
.report-report-table th{
  background:rgba(93,214,255,0.08);
  color:var(--accent);
  font-weight:600;
  font-size:11px;
  padding:6px 10px;
  border:1px solid var(--line);
  white-space:nowrap;
}
.report-report-table td{
  padding:8px 10px;
  border:1px solid var(--line);
  vertical-align:top;
}
.report-report-table tr:hover td{background:rgba(255,255,255,0.03);}
.report-activity-text{font-size:12px;color:var(--muted);line-height:1.5;white-space:pre-wrap;}
.report-next-task{font-size:12px;color:var(--text);line-height:1.5;}
.report-next-due{font-size:11px;color:var(--muted);margin-top:2px;}

.report-badge{
  display:inline-block;
  padding:1px 7px;
  border-radius:4px;
  font-size:11px;
  font-weight:600;
  white-space:nowrap;
}
.report-badge.risk{background:rgba(255,107,107,0.15);color:#ff6b6b;border:1px solid rgba(255,107,107,0.3);}
.report-badge.warn{background:rgba(255,152,0,0.15);color:#ff9800;border:1px solid rgba(255,152,0,0.3);}
.report-badge.ok{background:rgba(76,175,80,0.15);color:#4caf50;border:1px solid rgba(76,175,80,0.3);}
.report-badge.neutral{background:rgba(93,214,255,0.1);color:var(--accent);border:1px solid rgba(93,214,255,0.2);}

.report-risk-table{width:100%;border-collapse:collapse;font-size:13px;}
.report-risk-table th{
  background:rgba(255,107,107,0.08);
  color:#ff6b6b;
  font-weight:600;
  font-size:11px;
  padding:6px 10px;
  border:1px solid var(--line);
  white-space:nowrap;
}
.report-risk-table td{
  padding:7px 10px;
  border:1px solid var(--line);
  vertical-align:middle;
}
.report-risk-table tr:hover td{background:rgba(255,255,255,0.03);}
.report-proj-link{
  color:var(--text);
  text-decoration:none;
  font-size:12px;
  padding:2px 6px;
  border:1px solid var(--line);
  border-radius:4px;
}
.report-proj-link:hover{color:var(--accent);border-color:var(--accent);}
.report-empty{padding:20px;text-align:center;color:var(--muted);font-size:13px;}

.sentiment-icon{font-size:14px;}
.weekly-report-week-select{min-width:220px;}

/* ── 管理者KPI 案件管理 / スクリプト管理 ──────────── */
.admin-filter-bar{margin:12px 0;}
.admin-project-search{width:300px;}
.admin-project-msg{margin-top:8px;}
.admin-script-layout{margin-top:12px;}
.row-align-start{align-items:flex-start;}
.script-textarea{min-height:320px;}

@media (max-width: 900px){
  .product-family-grid{grid-template-columns:1fr}
  .product-plan-row{grid-template-columns:1fr}
  .product-plan-note{white-space:normal}
}

/* ── Login panel ──────────────────────────────────── */
.login-panel{max-width:400px;margin:60px auto;}
.login-panel h2{text-align:center;margin-bottom:8px;}
.login-error{color:var(--bad);text-align:center;display:none;margin-bottom:8px;}
.login-ms-wrap{margin:20px 0 16px;}
.login-ms-btn{
  display:flex;align-items:center;justify-content:center;gap:10px;
  width:100%;background:#0078d4;color:#fff;border-color:#0078d4;
  text-decoration:none;padding:10px 0;border-radius:4px;font-size:14px;
}
.login-ms-btn:hover{background:#006cbf;border-color:#006cbf;}
.login-local-summary{
  cursor:pointer;font-size:12px;color:var(--muted);
  text-align:center;list-style:none;padding:4px 0;
}
.login-local-body{
  margin-top:12px;padding:12px;
  background:var(--bg);border-radius:4px;border:1px solid var(--line);
}
.login-local-hint{font-size:11px;}
