:root {
  --sidebar-w: 260px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  padding: 0;
  background-color: var(--color-white, #ffffff);
  color: var(--color-font, #333);
  font-size: var(--font-size-basic);
  line-height: 1.6;
}
td>strong {color: var(--border-accent);}
/* Header */
.manual-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--color-white, #ffffff);
  border-bottom: 1px solid var(--border, #e7e7e7);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  height: 60px;
  width: 100%;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  height: 100%;
  width: 100%;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--font-size-emphasis);
  font-weight: 700;
  color: var(--color-font, #333);
}
.header-brand i {
  color: var(--color-submit, #80191f);
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border, #e7e7e7);
  background: var(--color-white, #ffffff);
  color: var(--color-darkgray, #555);
  font-size: var(--font-size-small);
  border-radius: var(--radius-basic, 5px);
  cursor: pointer;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.15s ease;
}
.header-btn:hover {
  background: var(--color-lightgray, #fafafa);
}
.header-btn.btn-primary {
  background: var(--color-submit, #80191f);
  color: var(--color-white, #ffffff);
  border-color: var(--color-submit, #80191f);
}
.header-btn.btn-primary:hover {
  background: var(--color-black, #000);
}
.lang-group {
  display: inline-flex;
  border: 1px solid var(--border, #e7e7e7);
  border-radius: var(--radius-basic, 5px);
  overflow: hidden;
  margin: 0 4px;
}
.lang-btn {
  padding: 6px 12px;
  font-size: var(--font-size-small);
  font-weight: 600;
  text-decoration: none;
  color: var(--color-downgray, #777);
  background: var(--color-white, #ffffff);
  border-right: 1px solid var(--border, #e7e7e7);
  transition: all 0.15s ease;
}
.lang-btn:last-child { border-right: none; }
.lang-btn:hover { background: var(--color-lightgray, #fafafa); color: var(--color-font, #333); }
.lang-btn.active {
  background: rgba(128, 25, 31, 0.08);
  color: var(--color-submit, #80191f);
  font-weight: 700;
}

/* Layout: Sidebar (Left) + Content (Right 100%) */
.layout-container {
  display: flex;
  width: 100%;
  min-height: calc(100vh - 60px);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--color-white, #ffffff);
  border-right: 1px solid var(--border, #e7e7e7);
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
  overflow-y: auto;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.sidebar-section-label {
  font-size: var(--font-size-tiny);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-downgray, #777);
  padding: 0 8px;
  margin-bottom: 8px;
}
.nav-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-basic, 5px);
  font-size: var(--font-size-basic);
  color: var(--color-darkgray, #555);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.nav-item i {
  width: 20px;
  text-align: center;
  color: var(--color-downgray, #777);
}
.nav-item:hover {
  background: var(--color-lightgray, #fafafa);
  color: var(--color-font, #333);
}
.nav-item:hover i {
  color: var(--color-submit, #80191f);
}
.nav-item.active {
  background: rgba(128, 25, 31, 0.08);
  color: var(--color-submit, #80191f);
  font-weight: 700;
  border-color: rgba(128, 25, 31, 0.15);
}
.nav-item.active i {
  color: var(--color-submit, #80191f);
}

/* Sub-navigation (TOC) inside active item */
.sub-nav-list {
  display: none;
  flex-direction: column;
  gap: 4px;
  margin-left: 20px;
  padding-left: 12px;
  border-left: 2px solid var(--border, #e7e7e7);
  margin-top: 4px;
  margin-bottom: 6px;
}
.nav-group.active .sub-nav-list {
  display: flex;
}
.sub-nav-link {
  color: var(--color-downgray, #777);
  font-size: var(--font-size-small);
  text-decoration: none;
  padding: 5px 8px;
  border-radius: var(--radius-btn, 3px);
  font-weight: 500;
  transition: all 0.15s ease;
}
.sub-nav-link:hover {
  color: var(--color-submit, #80191f);
  background: var(--color-lightgray, #fafafa);
}

/* Main Content Area (100% Width) */
.main-content {
  flex: 1;
  min-width: 0;
  width: 100%;
  padding: 32px 48px 80px;
  background-color: var(--color-white, #ffffff);
}
.content-inner {
  width: 100%;
}

/* Tab Panes */
.tab-pane {
  display: none;
  width: 100%;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
}
.tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Headings & Navigation */
.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--font-size-small);
  font-weight: 600;
  color: var(--color-downgray, #777);
  margin-bottom: 14px;
}
.section-title {
  font-size: var(--font-size-title);
  font-weight: 800;
  color: var(--color-font, #333);
  margin: 0 0 20px 0;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border, #e7e7e7);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sub-title {
  font-size: var(--font-size-emphasis);
  font-weight: 700;
  margin: 34px 0 14px;
  color: var(--color-font, #333);
  display: flex;
  align-items: center;
  gap: 8px;
  scroll-margin-top: 80px;
}

/* Callout Info Box */
.info-box {
  margin: 18px 0 26px;
  padding: 18px 22px;
  font-size: var(--font-size-basic);
  background-color: var(--color-lightgray, #fafafa);
  border: 1px solid var(--border, #e7e7e7);
  border-left: 4px solid var(--color-submit, #80191f);
  border-radius: var(--radius-basic, 5px);
  line-height: 1.7;
}
.info-box-title {
  font-size: var(--font-size-enlarge);
  font-weight: 700;
  color: var(--color-submit, #80191f);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Tables (Using style.css table.list rules) */
.layerpopup table.detail th, .layerpopup table.detail td, table.list th, table.list td {
  text-align: left !important;
  vertical-align: top;
}

table.list {width:100%;}
table.list td.bold {
  font-weight: 700;
  color: var(--color-font, #333);
}
table.list td {
  white-space:wrap;
  over-flow:auto;
}

/* Badges */
.manual-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-btn, 3px);
  font-size: var(--font-size-tiny);
  font-weight: 700;
  vertical-align: middle;
}
.badge-blue { background-color: #e0f2fe; color: #0369a1; }
.badge-red { background-color: #fee2e2; color: #b91c1c; }
.badge-green { background-color: #dcfce7; color: #15803d; }
.badge-purple { background-color: #f3e8ff; color: #7e22ce; }
.badge-orange { background-color: #ffedd5; color: #c2410c; }

/* CRUD Matrix Table */
.crud-matrix-header {
  margin-top: 36px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  scroll-margin-top: 80px;
}
.crud-matrix-title { font-size: var(--font-size-emphasis); font-weight: 700; color: var(--color-font, #333); display: flex; align-items: center; gap: 8px; }
.crud-legend { font-size: var(--font-size-small); color: var(--color-downgray, #777); display: flex; gap: 12px; }
.crud-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 8px;
  border: 1px solid var(--border, #e7e7e7);
  border-radius: var(--radius-basic, 5px);
  overflow: hidden;
}
.crud-table th, .crud-table td {
  border-right: 1px solid var(--border, #e7e7e7);
  border-bottom: 1px solid var(--border, #e7e7e7);
  padding: 10px 12px;
  font-size: var(--font-size-small);
  text-align: center;
}
.crud-table th:last-child, .crud-table td:last-child {
  border-right: none;
}
.crud-table tr:last-child td {
  border-bottom: none;
}
.crud-table th { background: var(--bg-th, #fafafa); font-weight: 700; color: var(--color-font, #333); }
.crud-table td.cat-cell { background: var(--color-lightgray, #fafafa); font-weight: 700; color: var(--color-font, #333); }
.badge-crud {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-btn, 3px);
  font-size: var(--font-size-tiny);
  font-weight: 700;
}
.badge-full { background: #fee2e2; color: #b91c1c; }
.badge-r { background: #e0f2fe; color: #0369a1; }
.badge-own { background: #dcfce7; color: #15803d; }
.badge-none { color: var(--color-comment, #aaa); }

/* Responsive & Mobile */
@media (max-width: 900px) {
  .layout-container { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 60px;
    z-index: 900;
    border-right: none;
    border-bottom: 1px solid var(--border, #e7e7e7);
    padding: 10px 14px;
    background: var(--color-white, #ffffff);
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
  }
  .sidebar-section-label { display: none; }
  .nav-group {
    display: inline-flex;
    flex-direction: row;
    flex-shrink: 0;
  }
  .nav-item {
    padding: 7px 12px;
    font-size: var(--font-size-small);
    white-space: nowrap;
    border: 1px solid var(--border, #e7e7e7);
    background: var(--color-lightgray, #fafafa);
    margin-bottom: 3.5px;
    min-width: 186px;
  }
  .nav-item.active {
    background: rgba(128, 25, 31, 0.08);
    border-color: var(--color-submit, #80191f);
  }
  .sub-nav-list { display: none !important; }
  .main-content { padding: 20px 16px 60px; }
  .tab-pane { padding: 0; }
}

@media (max-width: 600px) {
  .header-inner { padding: 0 12px; }
  .header-brand span { font-size:var(--font-size-enlarge); max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .header-btn-text { display: none; }
  .header-btn { padding: 6px 10px; }
  .lang-btn { padding: 5px 8px; font-size:var(--font-size-small); }
  .info-box { padding: 14px 16px; margin: 14px 0 20px; }
}

/* Print and PDF Export */
@media print {
  body { background: #ffffff !important; }
  .manual-header, .sidebar, .page-breadcrumb { display: none !important; }
  .layout-container { display: block !important; }
  .main-content { padding: 0 !important; margin: 0 !important; width: 100% !important; }
  .tab-pane {
    display: block !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin-bottom: 40px;
    page-break-after: always;
  }
  .tab-pane:last-child { page-break-after: auto; }
  table.list, .crud-table { page-break-inside: auto; }
  tr { page-break-inside: avoid; page-break-after: auto; }
  thead { display: table-header-group; }
}
