/* ===================================================================
   AFS Core モックアプリ — メインスタイルシート v2.0
   AFSクラフトデリカ船橋 営業提案用モック
=================================================================== */

/* --------- CSS変数 --------- */
:root {
  --red:          #e53935;
  --red-dark:     #c62828;
  --red-mid:      #ef5350;
  --red-light:    #ffebee;
  --red-pale:     #fff5f5;
  --blue:         #1976d2;
  --blue-light:   #e3f2fd;
  --green:        #388e3c;
  --green-light:  #e8f5e9;
  --orange:       #f57c00;
  --orange-light: #fff3e0;
  --purple:       #7b1fa2;
  --purple-light: #f3e5f5;

  --sidebar-w:    210px;
  --sidebar-mini: 52px;
  --hdr-h:        54px;

  --bg:           #f0f2f5;
  --bg-white:     #ffffff;
  --bg-card:      #ffffff;
  --border:       #e0e0e0;
  --border-dark:  #c8c8c8;

  --txt:          #1a1a2e;
  --txt2:         #555566;
  --txt3:         #909099;

  --shadow-sm:    0 1px 4px rgba(0,0,0,.08);
  --shadow:       0 2px 10px rgba(0,0,0,.10);
  --shadow-lg:    0 4px 20px rgba(0,0,0,.14);
  --radius:       6px;
  --radius-lg:    10px;

  --font: 'Noto Sans JP', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Meiryo', sans-serif;

  --anim: 0.18s ease;
}

/* --------- Reset --------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%; width: 100%;
  font-family: var(--font);
  font-size: 13px;
  color: var(--txt);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: var(--font); }

/* ====================================================================
   LAYOUT
==================================================================== */
.app-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ====================================================================
   SIDEBAR
==================================================================== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: #1e2235;
  color: #c8cde8;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width var(--anim), min-width var(--anim);
  z-index: 200;
  flex-shrink: 0;
  scrollbar-width: thin;
  scrollbar-color: #333658 transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: #333658; border-radius: 4px; }

.sidebar.collapsed {
  width: var(--sidebar-mini);
  min-width: var(--sidebar-mini);
}
.sidebar.collapsed .menu-text,
.sidebar.collapsed .nav-group-label,
.sidebar.collapsed .sidebar-logo,
.sidebar.collapsed .sidebar-ver { display: none !important; }

/* ---- sidebar header ---- */
.sidebar-header {
  height: var(--hdr-h);
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
  gap: 10px;
}
.hamburger-btn {
  background: none; border: none; cursor: pointer;
  width: 28px; height: 28px; flex-shrink: 0;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  border-radius: 4px;
  transition: background var(--anim);
}
.hamburger-btn:hover { background: rgba(255,255,255,.08); }
.hamburger-btn span {
  display: block; width: 20px; height: 2px;
  background: #c8cde8; border-radius: 2px;
  transition: transform var(--anim);
}

.sidebar-logo-wrap { display: flex; align-items: center; gap: 8px; overflow: hidden; }
.sidebar-logo-mark {
  width: 26px; height: 26px; flex-shrink: 0;
  background: var(--red);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 900; color: #fff; letter-spacing: -1px;
}
.sidebar-logo {
  font-size: 13px; font-weight: 700;
  color: #fff; white-space: nowrap;
  letter-spacing: .5px;
}

/* ---- nav items ---- */
.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-group-label {
  padding: 14px 16px 4px;
  font-size: 9.5px;
  color: #6871a0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

.nav-item {
  display: flex; align-items: center;
  padding: 8px 16px;
  cursor: pointer;
  color: #a0a8cc;
  text-decoration: none;
  transition: background var(--anim), color var(--anim);
  white-space: nowrap;
  overflow: hidden;
  font-size: 12.5px;
  gap: 10px;
  position: relative;
  border-radius: 0;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #dde1f5; }
.nav-item.active {
  background: rgba(229,57,53,.18);
  color: #ff8a80;
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; background: var(--red);
  border-radius: 0 3px 3px 0;
}
.nav-item.disabled { opacity: .45; cursor: default; pointer-events: none; }

.nav-icon {
  width: 20px; height: 20px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.menu-text { font-size: 12px; line-height: 1.4; }

.nav-sub-item { padding-left: 40px; font-size: 12px; }
.sidebar.collapsed .nav-sub-item { padding-left: 16px; }

.sidebar-footer {
  padding: 10px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sidebar-ver {
  font-size: 10px; color: #4a5070;
}

/* ====================================================================
   MAIN CONTENT
==================================================================== */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ====================================================================
   PAGE HEADER
==================================================================== */
.page-header {
  height: var(--hdr-h);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 10;
}
.page-title {
  font-size: 17px; font-weight: 700;
  color: var(--txt);
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
}
.page-title-icon {
  width: 30px; height: 30px;
  background: var(--red-light);
  color: var(--red);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.header-divider { width: 1px; height: 24px; background: var(--border); }

.header-controls { display: flex; align-items: center; gap: 8px; flex: 1; }
.header-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* date picker */
.date-input-wrap { display: flex; align-items: center; gap: 6px; }
.date-input {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 10px; font-size: 13px; color: var(--txt);
  background: var(--bg); transition: border-color var(--anim);
  outline: none;
}
.date-input:focus { border-color: var(--red); background: #fff; }

.btn-today {
  background: var(--red); color: #fff;
  border: none; border-radius: var(--radius);
  padding: 6px 14px; font-size: 12px; cursor: pointer;
  font-weight: 700; letter-spacing: .5px;
  transition: background var(--anim), transform var(--anim);
}
.btn-today:hover { background: var(--red-dark); transform: translateY(-1px); }
.btn-today:active { transform: translateY(0); }

/* search */
.search-group { display: flex; gap: 6px; }
.search-input-wrap { position: relative; }
.search-input-wrap i {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--txt3); font-size: 12px; pointer-events: none;
}
.search-input {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 10px 6px 28px; font-size: 12px; width: 130px;
  outline: none; background: var(--bg);
  transition: border-color var(--anim), width var(--anim), background var(--anim);
}
.search-input:focus { border-color: var(--red); background: #fff; width: 155px; }

.select-dropdown {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 6px 10px; font-size: 12px; background: var(--bg);
  cursor: pointer; outline: none; color: var(--txt);
  transition: border-color var(--anim);
}
.select-dropdown:focus { border-color: var(--red); background: #fff; }

/* ====================================================================
   PAGE BODY (generic)
==================================================================== */
.page-view { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.page-view.scrollable { overflow-y: auto; }

.page-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  gap: 10px;
}

/* ====================================================================
   FILTER BAR
==================================================================== */
.filter-bar {
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  flex-shrink: 0;
}
.filter-btn {
  border: 1px solid var(--border); border-radius: 20px;
  padding: 5px 14px; font-size: 12px; cursor: pointer;
  background: var(--bg-white); color: var(--txt2);
  transition: all var(--anim); white-space: nowrap;
  font-family: var(--font); font-weight: 500;
}
.filter-btn:hover { border-color: var(--red-mid); color: var(--red); background: var(--red-pale); }
.filter-btn.active {
  background: var(--red); color: #fff; border-color: var(--red);
  font-weight: 700; box-shadow: 0 2px 6px rgba(229,57,53,.35);
}
.filter-separator { width: 1px; height: 22px; background: var(--border); margin: 0 2px; }

/* ====================================================================
   TAB BAR
==================================================================== */
.tab-bar {
  display: flex; align-items: center;
  background: var(--bg-white);
  border-radius: var(--radius) var(--radius) 0 0;
  border-bottom: 2px solid var(--border);
  gap: 0; flex-shrink: 0; overflow-x: auto;
}
.tab-btn {
  padding: 9px 16px; font-size: 12.5px;
  background: none; border: none; cursor: pointer;
  color: var(--txt2);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all var(--anim); white-space: nowrap;
  font-family: var(--font); font-weight: 500;
}
.tab-btn:hover { color: var(--txt); background: var(--red-pale); }
.tab-btn.active {
  color: var(--red); border-bottom-color: var(--red);
  font-weight: 700; background: var(--red-pale);
}

/* ====================================================================
   TABLES AREA (2-pane)
==================================================================== */
.tables-area {
  flex: 1; display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px; overflow: hidden; min-height: 0;
}
.table-panel {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

/* panel header */
.panel-header {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(135deg, #f8f8fb 0%, #f2f3f8 100%);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; flex-wrap: wrap;
}
.panel-label-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 24px;
  background: var(--red); color: #fff;
  font-size: 12px; font-weight: 800; border-radius: 4px;
  letter-spacing: .5px; flex-shrink: 0;
}
.panel-stats {
  display: flex; gap: 14px; font-size: 11.5px; color: var(--txt2);
  flex-wrap: wrap; align-items: center; flex: 1;
}
.panel-stat-item {
  display: flex; align-items: center; gap: 4px;
}
.panel-stat-item .stat-label { color: var(--txt3); }
.panel-stat-item .stat-val { font-weight: 700; color: var(--txt); }
.panel-stat-item .stat-val.red { color: var(--red); }
.panel-stat-sep { color: var(--txt3); }

/* data table */
.table-scroll { flex: 1; overflow-y: auto; overflow-x: auto; min-height: 0; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table thead th {
  background: #eef0f6;
  padding: 7px 8px;
  text-align: left; white-space: nowrap;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--txt2); font-weight: 700; font-size: 11px;
  position: sticky; top: 0; z-index: 1;
  letter-spacing: .3px;
}
.data-table thead th:last-child { border-right: none; }
.data-table tbody tr {
  border-bottom: 1px solid #f2f2f5; cursor: pointer;
  transition: background var(--anim);
}
.data-table tbody tr:hover { background: #f7f8fc; }
.data-table tbody tr.row-complete { background: #f0faf0; }
.data-table tbody tr.row-selected { background: #e8f0fe; }
.data-table tbody td {
  padding: 6px 8px;
  border-right: 1px solid #f0f0f4;
  white-space: nowrap; vertical-align: middle;
}
.data-table tbody td:last-child { border-right: none; }

/* column widths */
.col-itemno { width: 68px; }
.col-name   { min-width: 120px; max-width: 190px; }
.col-jan    { width: 122px; }
.col-price  { width: 60px; text-align: right; }
.col-shipped{ width: 100px; }
.col-done   { width: 46px; text-align: center; }

.item-no-text { font-weight: 600; color: var(--txt2); font-size: 11.5px; }
.item-name-text { font-size: 12px; }
.jan-text { font-size: 10.5px; color: var(--txt3); }
.price-text { font-size: 12px; font-weight: 600; }

/* badges */
.badge {
  display: inline-flex; align-items: center;
  border-radius: 3px; padding: 1px 6px;
  font-size: 10px; font-weight: 700;
  margin-left: 4px; vertical-align: middle;
  line-height: 1.5;
}
.badge-special { background: #fff3e0; color: #e65100; border: 1px solid #ffe0b2; }
.badge-we      { background: #e8eaf6; color: #3949ab; border: 1px solid #c5cae9; }
.badge-tohoku  { background: #e0f2f1; color: #00695c; border: 1px solid #b2dfdb; }
.badge-hayade  { background: #fce4ec; color: #c62828; border: 1px solid #f8bbd0; }

/* shipped ratio */
.shipped-cell { display: flex; align-items: center; gap: 5px; }
.shipped-bar-wrap {
  width: 44px; height: 5px;
  background: #e8eaf0; border-radius: 3px; overflow: hidden; flex-shrink: 0;
}
.shipped-bar { height: 100%; border-radius: 3px; transition: width .4s ease; }
.bar-complete { background: #43a047; }
.bar-partial  { background: #fb8c00; }
.bar-zero     { background: #e8eaf0; width: 0; }
.shipped-text { font-size: 11.5px; color: var(--txt2); }

/* done icon */
.done-icon { font-size: 15px; line-height: 1; }
.done-yes { color: #43a047; }
.done-mid { color: #fb8c00; }
.done-no  { color: #cccccc; }

/* ====================================================================
   PAGINATION
==================================================================== */
.panel-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0; background: #fafbfc;
}
.panel-footer-count { font-size: 11px; color: var(--txt3); }
.pagination { display: flex; align-items: center; gap: 2px; }
.page-btn {
  min-width: 28px; height: 28px; padding: 0 6px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 5px;
  background: #fff; cursor: pointer;
  font-size: 12px; color: var(--txt);
  transition: all var(--anim);
}
.page-btn:hover:not(:disabled) { border-color: var(--red); color: var(--red); background: var(--red-pale); }
.page-btn.active { background: var(--red); color: #fff; border-color: var(--red); font-weight: 700; box-shadow: 0 1px 4px rgba(229,57,53,.4); }
.page-btn:disabled { opacity: .35; cursor: default; }
.page-ellipsis { padding: 0 4px; color: var(--txt3); font-size: 12px; }

/* ====================================================================
   KPI CARDS
==================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.kpi-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--anim), transform var(--anim);
  position: relative; overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--kpi-color, var(--red));
}
.kpi-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.kpi-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi-label { font-size: 11.5px; color: var(--txt2); font-weight: 500; }
.kpi-icon {
  width: 34px; height: 34px;
  background: var(--kpi-bg, var(--red-light));
  color: var(--kpi-color, var(--red));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.kpi-value { font-size: 26px; font-weight: 800; color: var(--txt); line-height: 1; margin-bottom: 4px; }
.kpi-value .kpi-unit { font-size: 13px; font-weight: 500; color: var(--txt2); margin-left: 3px; }
.kpi-sub { font-size: 11px; color: var(--txt3); }
.kpi-trend { display: flex; align-items: center; gap: 3px; font-size: 11px; }
.trend-up   { color: #43a047; }
.trend-down { color: var(--red); }

/* ====================================================================
   SECTION CARD (汎用コンテナ)
==================================================================== */
.section-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.section-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #f8f8fb 0%, #f2f3f8 100%);
}
.section-card-title {
  font-size: 13.5px; font-weight: 700; color: var(--txt);
  display: flex; align-items: center; gap: 7px;
}
.section-card-title i { color: var(--red); font-size: 14px; }
.section-card-body { padding: 16px 18px; }

/* ====================================================================
   PROGRESS PAGE
==================================================================== */
.progress-wrap { padding: 16px; display: flex; flex-direction: column; gap: 16px; overflow-y: auto; flex: 1; }

.progress-table-wrap {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.progress-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.progress-table thead th {
  background: #eef0f6;
  padding: 9px 14px; text-align: left;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--txt2); font-weight: 700; font-size: 11px;
  white-space: nowrap;
}
.progress-table thead th:last-child { border-right: none; }
.progress-table tbody tr { border-bottom: 1px solid #f2f2f5; transition: background var(--anim); }
.progress-table tbody tr:hover { background: #f7f8fc; }
.progress-table tbody td {
  padding: 9px 14px; border-right: 1px solid #f0f0f4;
  vertical-align: middle;
}
.progress-table tbody td:last-child { border-right: none; }
.section-badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 800; letter-spacing: .5px;
}
.sb-pc { background: #e3f2fd; color: #1565c0; }
.sb-rs { background: #e8f5e9; color: #2e7d32; }
.sb-we { background: #ede7f6; color: #6a1b9a; }
.sb-tohoku { background: #e0f2f1; color: #00695c; }
.sb-das  { background: #fff3e0; color: #e65100; }
.sb-tsort{ background: #fce4ec; color: #880e4f; }

.prog-bar-wrap {
  width: 100px; height: 7px; background: #e8eaf0;
  border-radius: 4px; overflow: hidden; display: inline-block;
  vertical-align: middle; margin-right: 7px;
}
.prog-bar-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }
.pf-high   { background: linear-gradient(90deg, #43a047, #66bb6a); }
.pf-mid    { background: linear-gradient(90deg, #fb8c00, #ffa726); }
.pf-low    { background: linear-gradient(90deg, var(--red), var(--red-mid)); }

/* status chip */
.status-chip {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 20px; padding: 3px 10px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}
.chip-done    { background: #e8f5e9; color: #2e7d32; }
.chip-going   { background: #fff3e0; color: #e65100; }
.chip-pending { background: #f5f5f5;  color: #757575; }
.chip-alert   { background: #ffebee; color: var(--red); }

/* ====================================================================
   CHART (custom bar)
==================================================================== */
.chart-wrap {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.chart-title {
  font-size: 13px; font-weight: 700; color: var(--txt);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 7px;
}
.chart-title i { color: var(--red); }
.bar-chart-area {
  display: flex; align-items: flex-end; gap: 5px;
  height: 120px; padding-bottom: 0;
}
.bar-chart-col {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; gap: 3px;
}
.bar-chart-val { font-size: 9.5px; color: var(--txt3); }
.bar-chart-bar {
  width: 100%; border-radius: 3px 3px 0 0;
  min-height: 2px; position: relative;
  transition: height .4s ease;
}
.bar-chart-label {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding-top: 5px;
}
.bar-chart-labels {
  display: flex; gap: 5px; border-top: 1px solid var(--border);
  margin-top: 2px; padding-top: 4px;
}
.bar-lbl { flex: 1; text-align: center; font-size: 10px; color: var(--txt3); }

/* ====================================================================
   T-Sort実績 / DAS実績 テーブル
==================================================================== */
.result-wrap { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; }

.result-kpi-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.generic-table-wrap {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.generic-table-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: linear-gradient(135deg, #f8f8fb 0%, #f2f3f8 100%);
  border-bottom: 1px solid var(--border);
}
.generic-table-title {
  font-size: 13px; font-weight: 700; color: var(--txt);
  display: flex; align-items: center; gap: 6px;
}
.generic-table-title i { color: var(--red); }
.generic-table-actions { display: flex; gap: 6px; }

.generic-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.generic-table thead th {
  background: #eef0f6; padding: 8px 12px;
  text-align: left; white-space: nowrap;
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--txt2); font-weight: 700; font-size: 11px;
  position: sticky; top: 0; z-index: 1;
}
.generic-table thead th:last-child { border-right: none; }
.generic-table tbody tr { border-bottom: 1px solid #f2f2f5; transition: background var(--anim); }
.generic-table tbody tr:hover { background: #f7f8fc; }
.generic-table tbody td {
  padding: 7px 12px; border-right: 1px solid #f0f0f4; vertical-align: middle;
}
.generic-table tbody td:last-child { border-right: none; }

.num-col { text-align: right; font-weight: 600; }
.center-col { text-align: center; }

/* accuracy/error rate circles */
.rate-ring {
  display: inline-flex; align-items: center;
  gap: 6px; vertical-align: middle;
}
.rate-circle {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
  border: 3px solid currentColor;
}
.rate-good  { color: #43a047; background: #e8f5e9; }
.rate-warn  { color: #fb8c00; background: #fff3e0; }
.rate-bad   { color: var(--red); background: var(--red-light); }

/* inline mini bar */
.mini-bar-wrap {
  width: 80px; height: 6px; background: #e8eaf0;
  border-radius: 3px; overflow: hidden; display: inline-block;
  vertical-align: middle; margin-right: 5px;
}
.mini-bar { height: 100%; border-radius: 3px; }
.mb-blue   { background: var(--blue); }
.mb-green  { background: var(--green); }
.mb-orange { background: var(--orange); }
.mb-red    { background: var(--red); }

/* ====================================================================
   CAMERA PAGE
==================================================================== */
.camera-wrap { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; }
.camera-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.camera-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--anim);
}
.camera-card:hover { box-shadow: var(--shadow); }
.camera-feed {
  width: 100%; height: 180px;
  background: #0d0f1a;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.camera-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px;
}
.camera-scan-line {
  position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(229,57,53,.8), transparent);
  animation: scan 3s ease-in-out infinite;
}
@keyframes scan {
  0%   { top: 10%; opacity: 1; }
  50%  { top: 85%; opacity: .6; }
  100% { top: 10%; opacity: 1; }
}
.camera-live-badge {
  position: absolute; top: 8px; left: 10px;
  background: var(--red); color: #fff;
  font-size: 9.5px; font-weight: 800;
  padding: 2px 8px; border-radius: 3px;
  display: flex; align-items: center; gap: 4px;
  letter-spacing: .5px;
}
.camera-live-badge::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: #fff;
  animation: blink 1.2s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.2} }

.camera-timestamp {
  position: absolute; top: 8px; right: 10px;
  background: rgba(0,0,0,.7); color: #0f0;
  font-size: 10px; font-family: monospace;
  padding: 2px 8px; border-radius: 3px;
}
.camera-grid-lines {
  position: absolute; inset: 0;
  background:
    linear-gradient(rgba(229,57,53,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(229,57,53,.07) 1px, transparent 1px);
  background-size: 32px 32px;
}
.camera-corner {
  position: absolute;
  width: 14px; height: 14px;
  border-color: rgba(229,57,53,.8); border-style: solid;
}
.cc-tl { top: 14px; left: 14px;  border-width: 2px 0 0 2px; }
.cc-tr { top: 14px; right: 14px; border-width: 2px 2px 0 0; }
.cc-bl { bottom: 14px; left: 14px;  border-width: 0 0 2px 2px; }
.cc-br { bottom: 14px; right: 14px; border-width: 0 2px 2px 0; }

.camera-icon-area { color: rgba(229,57,53,.5); font-size: 38px; }
.camera-no-signal { color: rgba(255,255,255,.35); font-size: 12px; letter-spacing: .5px; }

.camera-info {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.camera-name { font-size: 12.5px; font-weight: 700; color: var(--txt); margin-bottom: 4px; }
.camera-meta { display: flex; gap: 10px; font-size: 11px; color: var(--txt3); }
.camera-status-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 4px;
}
.dot-online  { background: #43a047; }
.dot-offline { background: #bdbdbd; }
.dot-warn    { background: #fb8c00; }

/* ====================================================================
   TOP PAGE
==================================================================== */
.top-wrap { padding: 18px; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; flex: 1; }

.notice-list { display: flex; flex-direction: column; }
.notice-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--anim); cursor: pointer;
}
.notice-item:last-child { border-bottom: none; }
.notice-item:hover { background: var(--bg); }
.notice-badge {
  flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; padding: 2px 8px;
  font-size: 10px; font-weight: 800; margin-top: 2px;
  min-width: 38px;
}
.nb-alert { background: var(--red-light);  color: var(--red); }
.nb-info  { background: var(--blue-light); color: var(--blue); }
.nb-news  { background: var(--green-light);color: var(--green); }
.notice-body { flex: 1; }
.notice-title { font-size: 13px; font-weight: 600; color: var(--txt); margin-bottom: 3px; }
.notice-desc  { font-size: 11.5px; color: var(--txt2); line-height: 1.5; }
.notice-time  { font-size: 10.5px; color: var(--txt3); flex-shrink: 0; padding-top: 3px; }

/* ====================================================================
   SCROLL TO TOP
==================================================================== */
#scrollTopBtn {
  position: fixed; bottom: 22px; right: 22px;
  width: 38px; height: 38px;
  background: var(--red); color: #fff;
  border: none; border-radius: 50%; cursor: pointer;
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  transition: background var(--anim), transform var(--anim);
  opacity: .85;
}
#scrollTopBtn:hover { background: var(--red-dark); transform: translateY(-2px); opacity: 1; }

/* ====================================================================
   BUTTONS
==================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 5px 12px; font-size: 12px; cursor: pointer;
  background: var(--bg-white); color: var(--txt2);
  transition: all var(--anim); font-family: var(--font); font-weight: 500;
}
.btn:hover { border-color: var(--red); color: var(--red); background: var(--red-pale); }
.btn-primary {
  background: var(--red); color: #fff; border-color: var(--red); font-weight: 700;
}
.btn-primary:hover { background: var(--red-dark); border-color: var(--red-dark); color: #fff; }
.btn i { font-size: 11px; }

/* ====================================================================
   UTIL
==================================================================== */
.loading-row td { text-align: center; padding: 30px; color: var(--txt3); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.text-muted { color: var(--txt3); }
.text-red   { color: var(--red); }
.text-green { color: var(--green); }

/* ====================================================================
   AREA PROGRESS PAGE
==================================================================== */
.area-wrap { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; }

.area-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.area-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--area-color, var(--red));
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: box-shadow var(--anim), transform var(--anim);
}
.area-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.area-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.area-card-name { font-size: 13px; font-weight: 700; color: var(--txt); }
.area-card-section {
  font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 4px;
  background: var(--area-color, var(--red)); color: #fff;
}
.area-big-rate { font-size: 32px; font-weight: 800; color: var(--area-color, var(--red)); line-height: 1; margin-bottom: 4px; }
.area-big-rate span { font-size: 16px; font-weight: 600; }
.area-card-bar { height: 6px; background: #e8eaf0; border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.area-card-bar-fill { height: 100%; border-radius: 3px; background: var(--area-color, var(--red)); transition: width .5s ease; }
.area-card-stats { display: flex; justify-content: space-between; font-size: 11px; color: var(--txt3); }

/* Lane table */
.lane-section {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.lane-section-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  border-left: 4px solid var(--lane-color, var(--red));
  background: linear-gradient(135deg, #f8f8fb 0%, #f2f3f8 100%);
}
.lane-section-title { font-size: 13px; font-weight: 700; color: var(--txt); flex: 1; }
.lane-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.lane-table thead th {
  background: #eef0f6; padding: 7px 14px;
  text-align: left; border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--txt2); font-weight: 700; font-size: 11px;
}
.lane-table thead th:last-child { border-right: none; }
.lane-table tbody tr { border-bottom: 1px solid #f2f2f5; transition: background var(--anim); }
.lane-table tbody tr:hover { background: #f7f8fc; }
.lane-table tbody td { padding: 8px 14px; border-right: 1px solid #f0f0f4; vertical-align: middle; }
.lane-table tbody td:last-child { border-right: none; }

.lane-status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px;
}
.ls-good    { background: #43a047; box-shadow: 0 0 4px rgba(67,160,71,.6); }
.ls-running { background: #1976d2; box-shadow: 0 0 4px rgba(25,118,210,.6); }
.ls-slow    { background: #fb8c00; box-shadow: 0 0 4px rgba(251,140,0,.6); animation: pulse-warn 1.5s ease-in-out infinite; }
.ls-alert   { background: var(--red); box-shadow: 0 0 4px rgba(229,57,53,.6); animation: pulse-warn 1s ease-in-out infinite; }
@keyframes pulse-warn { 0%,100%{opacity:1} 50%{opacity:.4} }

/* Chart.js コンテナ */
.chartjs-wrap {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}
.chartjs-title {
  font-size: 13px; font-weight: 700; color: var(--txt);
  margin-bottom: 14px; display: flex; align-items: center; gap: 7px;
}
.chartjs-title i { color: var(--red); }

/* ====================================================================
   SCHEDULE PRINT PAGE
==================================================================== */
.print-wrap { padding: 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; }

.print-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.print-toolbar-title { font-size: 13.5px; font-weight: 700; color: var(--txt); flex: 1; }
.btn-print {
  background: #37474f; color: #fff; border: none;
  border-radius: var(--radius); padding: 7px 16px;
  font-size: 12.5px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font); transition: background var(--anim);
}
.btn-print:hover { background: #263238; }

/* 指示書プレビュー本体 */
.schedule-doc {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.doc-header {
  padding: 20px 28px 16px;
  border-bottom: 3px solid var(--red);
  display: flex; align-items: flex-start; justify-content: space-between;
  background: linear-gradient(135deg, #fff 0%, #fafafa 100%);
}
.doc-logo { display: flex; align-items: center; gap: 10px; }
.doc-logo-mark {
  width: 40px; height: 40px; background: var(--red); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900; color: #fff;
}
.doc-logo-text { font-size: 15px; font-weight: 800; color: var(--txt); }
.doc-logo-sub  { font-size: 11px; color: var(--txt3); }
.doc-title-block { text-align: right; }
.doc-title { font-size: 20px; font-weight: 800; color: var(--txt); margin-bottom: 4px; }
.doc-issue { font-size: 11.5px; color: var(--txt3); }

.doc-meta {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0; border-bottom: 1px solid var(--border);
}
.doc-meta-item {
  padding: 10px 20px;
  border-right: 1px solid var(--border);
}
.doc-meta-item:last-child { border-right: none; }
.doc-meta-label { font-size: 10px; color: var(--txt3); font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.doc-meta-value { font-size: 14px; font-weight: 700; color: var(--txt); }

.doc-section-title {
  font-size: 12px; font-weight: 700; color: var(--txt);
  padding: 10px 20px 6px;
  border-bottom: 1px solid var(--border);
  background: #f8f8fb;
  display: flex; align-items: center; gap: 6px;
}
.doc-section-title i { color: var(--red); }

.doc-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.doc-table thead th {
  background: #eef0f6; padding: 8px 14px;
  text-align: left; border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--txt2); font-weight: 700; font-size: 11px;
}
.doc-table thead th:last-child { border-right: none; }
.doc-table tbody tr { border-bottom: 1px solid #f2f2f5; }
.doc-table tbody tr:hover { background: #f7f8fc; }
.doc-table tbody td { padding: 8px 14px; border-right: 1px solid #f0f0f4; vertical-align: middle; }
.doc-table tbody td:last-child { border-right: none; }

.route-status-chip {
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: 20px; padding: 2px 10px;
  font-size: 10.5px; font-weight: 700; white-space: nowrap;
}
.rs-scheduled { background: #e3f2fd; color: #1565c0; }
.rs-loading   { background: #fff3e0; color: #e65100; }
.rs-departed  { background: #e8f5e9; color: #2e7d32; }
.rs-delayed   { background: var(--red-light); color: var(--red); }

.temp-chip {
  display: inline-flex; align-items: center; gap: 3px;
  border-radius: 3px; padding: 1px 7px;
  font-size: 10px; font-weight: 700;
}
.temp-cold   { background: #e3f2fd; color: #1565c0; }
.temp-frozen { background: #e8eaf6; color: #283593; }
.temp-normal { background: #f5f5f5; color: #616161; }

/* ====================================================================
   ISORT PAGE
==================================================================== */
.isort-wrap { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; }

/* ====================================================================
   CAMERA HISTORY PAGE
==================================================================== */
.cam-history-wrap { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; overflow-y: auto; flex: 1; }

.timeline-player {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.timeline-player-header {
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #0d0f1a 0%, #1a1d30 100%);
  display: flex; align-items: center; gap: 12px;
}
.timeline-player-title { font-size: 13px; font-weight: 700; color: #c8cde8; flex: 1; display: flex; align-items: center; gap: 7px; }
.timeline-player-title i { color: var(--red); }
.timeline-time-display {
  font-family: monospace; font-size: 18px; font-weight: 700;
  color: #0f0; letter-spacing: 2px;
  background: rgba(0,0,0,.5); padding: 4px 12px; border-radius: 4px;
}
.player-controls { display: flex; align-items: center; gap: 8px; }
.player-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2);
  color: #c8cde8; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all var(--anim);
}
.player-btn:hover { background: var(--red); border-color: var(--red); color: #fff; }
.player-btn.active { background: var(--red); border-color: var(--red); color: #fff; }

.timeline-track {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.timeline-label { font-size: 11px; color: var(--txt3); margin-bottom: 8px; font-weight: 600; }
.timeline-bar {
  display: flex; gap: 4px; align-items: stretch;
}
.timeline-segment {
  flex: 1; height: 28px; border-radius: 4px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: rgba(255,255,255,.9);
  transition: transform var(--anim), box-shadow var(--anim);
  position: relative;
}
.timeline-segment:hover { transform: scaleY(1.1); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.timeline-segment.active { box-shadow: 0 0 0 2px var(--red), 0 2px 8px rgba(229,57,53,.4); }
.timeline-seg-label {
  position: absolute; bottom: -18px; left: 50%; transform: translateX(-50%);
  font-size: 9.5px; color: var(--txt3); white-space: nowrap;
}

.snapshot-grid {
  padding: 14px 18px;
}
.snapshot-cameras {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px; margin-top: 10px;
}
.snap-camera {
  background: #0d0f1a; border-radius: var(--radius);
  overflow: hidden; border: 1px solid #2a2d40;
}
.snap-feed {
  height: 110px; position: relative;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0d0f1a 0%, #151829 100%);
}
.snap-feed.inactive { opacity: .35; }
.snap-overlay-grid {
  position: absolute; inset: 0;
  background:
    linear-gradient(rgba(229,57,53,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(229,57,53,.05) 1px, transparent 1px);
  background-size: 20px 20px;
}
.snap-cam-icon { color: rgba(229,57,53,.4); font-size: 24px; }
.snap-cam-id   { position: absolute; bottom: 5px; right: 7px; font-size: 9px; color: rgba(255,255,255,.3); font-family: monospace; }
.snap-active-badge {
  position: absolute; top: 5px; left: 6px;
  background: var(--red); color: #fff;
  font-size: 8.5px; font-weight: 800; padding: 1px 6px; border-radius: 2px;
}
.snap-info { padding: 5px 8px; }
.snap-name { font-size: 10.5px; color: #8890b0; font-weight: 600; }

/* イベントログ */
.event-log {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.event-log-header {
  padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #f8f8fb 0%, #f2f3f8 100%);
  display: flex; align-items: center; justify-content: space-between;
}
.event-log-title { font-size: 13px; font-weight: 700; color: var(--txt); display: flex; align-items: center; gap: 6px; }
.event-log-title i { color: var(--red); }
.event-list { max-height: 280px; overflow-y: auto; }
.event-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 16px; border-bottom: 1px solid #f2f2f5;
  transition: background var(--anim);
}
.event-item:hover { background: var(--bg); }
.event-time { font-family: monospace; font-size: 11.5px; color: var(--txt3); width: 40px; flex-shrink: 0; padding-top: 1px; }
.event-icon { width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; }
.ev-info { background: var(--blue-light); color: var(--blue); }
.ev-warn { background: var(--orange-light); color: var(--orange); }
.ev-alert{ background: var(--red-light);   color: var(--red); }
.event-body { flex: 1; }
.event-cam  { font-size: 10px; color: var(--txt3); margin-bottom: 2px; }
.event-desc { font-size: 12px; color: var(--txt); }

/* ====================================================================
   PRINT STYLES
==================================================================== */
@media print {
  .sidebar, .page-header, .print-toolbar, #scrollTopBtn { display: none !important; }
  .main-content { overflow: visible !important; }
  .page-view { display: block !important; overflow: visible !important; }
  .print-wrap { padding: 0; }
  .schedule-doc { box-shadow: none; border: none; }
  .doc-table tbody tr:hover { background: transparent !important; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}

/* ====================================================================
   RESPONSIVE
==================================================================== */
@media (max-width: 1100px) {
  .tables-area { grid-template-columns: 1fr; }
  .search-input { width: 110px; }
  .doc-meta { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .sidebar { width: var(--sidebar-mini); min-width: var(--sidebar-mini); }
  .sidebar .menu-text,
  .sidebar .nav-group-label,
  .sidebar .sidebar-logo,
  .sidebar .sidebar-ver { display: none; }
  .sidebar .nav-sub-item { padding-left: 16px; }
  .page-header { padding: 0 12px; gap: 8px; }
  .search-group { display: none; }
  .area-overview-grid { grid-template-columns: repeat(2, 1fr); }
  .camera-grid { grid-template-columns: 1fr 1fr; }
}
