/* =============================================================
 Consolidated styles for KIP Pseudo
 Date: 2026-01-23
 Notes:
 - Duplicate rules were merged by selector grouping (no HTML changes required)
 ============================================================= */
 :root{
  --side-w:240px; --bg:#f7f7f9; --border:#e5e7eb; --text:#111827; --muted:#6b7280;
  --link:#2563eb; --active:#1f2937; --content-bg:#ffffff;
}
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family:system-ui,-apple-system,"Segoe UI",Meiryo,"Hiragino Kaku Gothic ProN","Noto Sans JP",sans-serif;
  color:var(--text); background:var(--content-bg);
}

/* ===== Layout ===== */
.layout{ display:flex; min-height:100vh; background:var(--content-bg); }
.side{ display:flex; flex-direction:column; }
.brand{ font-weight:700; margin:4px 8px 16px; }

/* ===== Menu ===== */
.menu{ list-style:none; padding:0; margin:0; }
.menu li{ margin:4px 0; }
.menu a{
  display:block; padding:10px 12px; border-radius:8px; color:var(--link); text-decoration:none;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:pointer;
}
.menu a.active{ background:#fff; border:1px solid var(--border); color:var(--active); font-weight:600; }
.menu-bottom{ margin-top:auto; padding-top:16px; border-top:1px solid var(--border); }
.menu-bottom-link{ display:block; padding:10px 12px; border-radius:8px; color:var(--link); text-decoration:none; }
.menu-bottom-link:hover{ background:#fff; border:1px solid var(--border); color:var(--active); }

/* ===== Content ===== */
.content{ flex:1 1 auto; min-width:0; padding:24px; overflow-x:auto; }
h1{ margin-top:0; }

/* ===== Forms & Tables (common) ===== */
.row{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.row--stack{ grid-template-columns:1fr; }
input[type=text],textarea,select,input[type=file]{ width:100%; padding:6px; }

table{ border-collapse:collapse; width:100%; margin-top:16px; table-layout:fixed; }
th,td{ border:1px solid #ddd; padding:6px 8px; font-size:14px; word-break:break-word; }
th{ background:#fafafa; text-align:left; }

.actions{ margin-top:12px; }
.actions-right{ justify-self:start; }
@media (min-width:640px){ .actions-right{ justify-self:end; } }

.muted{ color:var(--muted); font-size:12px; }
img,video,canvas{ max-width:100%; height:auto; }

/* ===== Buttons ===== */
.btn-danger{
  background:#d32f2f; color:#fff; padding:6px 12px; border:none; border-radius:4px; cursor:pointer; font-size:14px;
}
.btn-danger:hover{ background:#b71c1c; }

/* ===== Collapsible (publish_command) ===== */
.cmd-panel{ border:1px solid var(--border); border-radius:8px; background:#fff; }
.cmd-panel>summary{
  list-style:none; cursor:pointer; padding:12px 14px; font-weight:600; border-bottom:1px solid var(--border);
}
.cmd-panel>summary::-webkit-details-marker{ display:none; }
.cmd-panel>summary::after{ content:"▼"; float:right; color:var(--muted); transition:transform .2s; }
.cmd-panel[open]>summary::after{ transform:rotate(-180deg); }
.cmd-panel-body{ padding:14px; }
.cmd-panel-grid{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media (max-width:900px){ .cmd-panel-grid{ grid-template-columns:1fr; } }
.cmd-list-box{ border:1px solid #ddd; border-radius:6px; padding:12px; background:#fff; max-height:400px; overflow:auto; }
.cmd-fieldset{ border:none; margin:0; padding:0; }
.cmd-radio{ display:block; margin:8px 0; cursor:pointer; }
.cmd-radio input{ margin-right:8px; }
.cmd-radio-name{ font-weight:600; }
.cmd-desc-title{ margin-top:0; }
.cmd-desc-heading{ font-weight:600; margin-bottom:6px; }
.cmd-desc-box{ border:1px solid #ddd; border-radius:6px; padding:12px; background:#f9f9f9; min-height:200px; word-break:break-word; overflow:auto; }

/* ===== Panels (merged) ===== */
.fw-panel, .fu-panel, .kc-panel, .rd-panel{
  border:1px solid var(--border); border-radius:6px; background:#f9f9f9; padding:20px; margin-bottom:20px;
}
.fu-panel h3, .kc-panel h3, .rd-panel h3{ margin-top:0; }

/* ===== Labels (merged) ===== */
.fw-label, .fu-label, .kc-label, .rd-label, .ip-label, .msg-label{
  display:block; margin-bottom:5px; font-weight:bold;
}

/* ===== Inputs (merged) ===== */
.fw-input, .fu-input, .kc-input, .rd-input, .ip-input, .msg-input{
  width:100%; padding:8px; box-sizing:border-box; border:1px solid #ccc; border-radius:4px;
}

/* ===== 2-column grids (merged) ===== */
.fu-grid-2, .kc-grid-2, .rd-grid-2, .ip-row-2, .msg-row-2{
  display:grid; grid-template-columns:1fr 1fr; gap:15px;
}

/* ===== Primary buttons (merged) ===== */
.fw-btn-primary, .fu-btn-primary, .kc-btn-primary, .rd-btn-primary, .ip-btn-primary, .msg-btn-primary{
  padding:8px 20px; background:#0066cc; color:#fff; border:none; border-radius:4px; cursor:pointer; font-size:14px; font-weight:700;
}

/* Secondary action links */
.fu-btn-secondary-link, .ip-btn-secondary, .msg-btn-secondary{
  padding:8px 16px; background:#999; color:#fff; border:none; border-radius:4px; cursor:pointer;
  text-decoration:none; text-align:center; display:inline-block;
}

/* ===== Tables (merged common rules) ===== */
.fw-table, .fu-table, .kc-table, .rd-table, .ip-table, .msg-table{
  width:100%; border-collapse:collapse;
}
.fw-table th, .fu-table th, .kc-table th, .rd-table th, .ip-table th, .msg-table th,
.fw-table td, .fu-table td, .kc-table td, .rd-table td, .ip-table td, .msg-table td{
  border:1px solid #ddd; padding:10px;
}
.fu-table thead th, .kc-table thead th, .rd-table thead th, .ip-table thead th, .msg-table thead th{
  background:#f5f5f5; text-align:left;
}
/* sticky header only for fw-table & msg-table */
.fw-table thead th{ position:sticky; top:0; }
.msg-table thead th{ position:sticky; top:0; }

/* Table wrappers (merged) */
.fw-file-table-wrap, .fu-table-wrap, .kc-table-wrap, .rd-table-wrap, .msg-table-wrap{
  overflow-x:auto; border:1px solid #ddd; border-radius:4px;
}

/* Alternating rows (merged) */
.fw-row-alt, .fu-row-alt, .kc-row-alt, .rd-row-alt, .ip-row-alt{
  background:#fafafa;
}

/* ===== firmware_update specifics ===== */
.fw-command-box{
  display:block; background:#fff; padding:10px; border-radius:3px; border:1px solid #ddd; overflow-x:auto; font-size:12px; margin-top:8px; white-space:pre;
}
.fw-file-select-header{ display:flex; justify-content:space-between; align-items:center; margin:20px 0 15px 0; }
.fw-file-table-wrap{ border:1px solid #ccc; border-radius:4px; overflow:auto; max-height:300px; }

/* ===== firmware_upload specifics ===== */
.fu-actions{ display:grid; grid-template-columns:auto; margin-top:10px; }
.fu-list-header{ display:flex; justify-content:space-between; align-items:center; margin:30px 0 15px 0; }
.fu-summary{ margin-top:15px; color:#666; font-size:13px; }
.fu-link{ color:#0066cc; text-decoration:none; }

/* ===== incidentpacket_files specifics ===== */
.ip-panel h3{ margin-top:0; }
.ip-action-row{ display:grid; grid-template-columns:auto auto; gap:10px; margin-top:5px; }
.ip-filter-note{ background:#fffacd; padding:10px; border-radius:4px; color:#333; }

/* ===== messages specifics ===== */
.msg-panel h3{ margin-top:0; }
.msg-action-row{ display:grid; grid-template-columns:auto auto auto; gap:10px; margin-top:5px; }
.msg-filter-note{ background:#fffacd; padding:10px; border-radius:4px; color:#333; }
.msg-col-resize{ position:absolute; right:0; top:0; width:4px; height:100%; cursor:col-resize; background:#ddd; }
.msg-payload{ margin:0; background:#f9f9f9; padding:5px; border-radius:3px; white-space:pre-wrap; word-break:break-word; }

/* ===== command_result specifics ===== */
.cr-panel{
  border:1px solid var(--border); border-radius:6px; background:#f9f9f9; padding:20px; margin-bottom:20px;
}
.cr-label{ display:block; margin-bottom:5px; font-weight:bold; }
.cr-input{ width:100%; padding:8px; box-sizing:border-box; border:1px solid #ccc; border-radius:4px; }
.cr-row-2{ display:grid; grid-template-columns:1fr 1fr; gap:15px; }
.cr-action-row{ display:grid; grid-template-columns:auto auto; gap:10px; margin-top:12px; }
.cr-btn-primary{
  padding:8px 20px; background:#0066cc; color:#fff; border:none; border-radius:4px; cursor:pointer; font-size:14px; font-weight:700;
}
.cr-btn-secondary{
  padding:8px 16px; background:#999; color:#fff; border:none; border-radius:4px; cursor:pointer;
  text-decoration:none; text-align:center; display:inline-block;
}
.cr-table-wrap{ overflow-x:auto; border:1px solid #ddd; border-radius:4px; }
.cr-table{ width:100%; border-collapse:collapse; }
.cr-table th, .cr-table td{ border:1px solid #ddd; padding:10px; vertical-align:top; }
.cr-table thead th{ background:#f5f5f5; text-align:left; position:sticky; top:0; }
.cr-row-alt{ background:#fafafa; }
.cr-payload{ margin:0; white-space:pre-wrap; word-break:break-word; background:#fff; }