/* Strict Runbook CSS v3.1 (Premium Typography) */
:root {
    --c-primary: #0056b3;
    --c-text-main: #212529;
    /* Slightly softer black for premium feel */
    --c-text-muted: #6c757d;
    --c-border: #999;
    --c-border-light: #dee2e6;

    --c-bg-head: #f8f9fa;
    --c-bg-code: #f1f3f5;
    --c-bg-stripe: #f8f9fa;
    --c-bg-critical: #fff3cd;
    --c-bg-fix: #d4edda;

    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "BIZ UDPGothic", "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
    --font-mono: "sf mono", "fira code", Consolas, Monaco, monospace;

    --container-width: 1280px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    /* Increased from 14px for better legibility */
    line-height: 1.6;
    color: var(--c-text-main);
    background: #fff;
    -webkit-font-smoothing: antialiased;
    /* Crisp text */
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--c-primary);
    text-decoration: none;
    font-weight: 600;
}

a:hover {
    text-decoration: underline;
    background-color: #e7f1ff;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    border-bottom: 3px solid #343a40;
    padding: 12px 0;
    margin-bottom: 24px;
    background: #fff;
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    font-weight: 800;
    font-size: 1.25rem;
    color: #000;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Search Box */
.search-box {
    flex: 1;
    max-width: 480px;
}

.search-box input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #495057;
    font-size: 14px;
    border-radius: 2px;
    background: #fff;
    font-family: var(--font-sans);
}

/* Typography & Headings */
h1,
h2,
h3 {
    margin: 0;
    font-weight: 700;
    color: #212529;
    line-height: 1.3;
}

h1 {
    font-size: 1.75rem;
    padding-bottom: 12px;
    border-bottom: 1px solid #ced4da;
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

h2 {
    font-size: 1.35rem;
    margin-top: 32px;
    margin-bottom: 12px;
    background: var(--c-bg-head);
    padding: 8px 12px;
    border-left: 5px solid #343a40;
    border-top: 1px solid #dee2e6;
    border-radius: 0 2px 2px 0;
}

h3 {
    font-size: 1.15rem;
    margin-top: 20px;
    margin-bottom: 8px;
    padding-left: 10px;
    border-left: 4px solid #868e96;
    color: #495057;
}

p,
ul,
ol {
    margin: 0 0 10px 0;
}

ul {
    padding-left: 24px;
}

code {
    background: var(--c-bg-code);
    padding: 2px 5px;
    font-family: var(--font-mono);
    font-size: 0.9em;
    color: #d63384;
    border-radius: 2px;
}

pre {
    background: #212529;
    color: #f8f9fa;
    padding: 12px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 13px;
    margin-bottom: 16px;
    border-left: 4px solid var(--c-primary);
    border-radius: 2px;
    line-height: 1.4;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
    /* Dense for tables */
    border: 1px solid var(--c-border-light);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    /* Very subtle depth */
}

th,
td {
    padding: 10px 12px;
    border: 1px solid var(--c-border-light);
    text-align: left;
    vertical-align: top;
}

th {
    background: #e9ecef;
    color: #495057;
    font-weight: 700;
    border-bottom: 2px solid #adb5bd;
    white-space: nowrap;
}

tr:nth-child(even) {
    background-color: var(--c-bg-stripe);
}

tr:hover {
    background-color: #e2e6ea !important;
}

/* Critical Columns */
td:first-child {
    font-weight: 700;
    color: #212529;
    background: #fff;
    font-family: var(--font-mono);
}

td:last-child {
    background: #f0fff4;
    color: #155724;
    font-weight: 500;
}

/* Layout Components */
.section-box,
.verdict-box {
    background: #fff;
    border: 1px solid #ced4da;
    padding: 16px;
    margin-bottom: 24px;
    border-radius: 2px;
}

.critical-box {
    border: 2px solid #ffc107;
    background: #fff9db;
    padding: 16px;
    margin-bottom: 24px;
    position: relative;
}

.critical-box::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #ffc107;
}

.fix-box {
    border: 1px solid #c3e6cb;
    background: #d4edda;
    padding: 16px;
    margin-top: 24px;
    color: #155724;
    border-radius: 4px;
}

/* Navigation & Grid */
.page-wrapper {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 30px;
    margin-bottom: 40px;
}

.sidebar-box {
    border: 1px solid #dee2e6;
    padding: 12px;
    margin-bottom: 20px;
    background: #f8f9fa;
    border-radius: 2px;
}

.sidebar-title {
    font-weight: 700;
    border-bottom: 1px solid #ced4da;
    margin-bottom: 10px;
    padding-bottom: 4px;
    font-size: 0.9rem;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-list li {
    margin-bottom: 6px;
}

.toc-list a {
    font-weight: 500;
    font-size: 0.9rem;
    color: #495057;
}

.toc-list a:hover {
    color: var(--c-primary);
}

/* Flow Diagram */
.flow-visual {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    overflow-x: auto;
    padding: 20px 0;
}

.flow-node {
    flex: 0 0 auto;
    border: 2px solid #495057;
    background: #fff;
    padding: 12px;
    border-radius: 6px;
    min-width: 140px;
    text-align: center;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.flow-node strong {
    display: block;
    margin-bottom: 6px;
    color: #212529;
    font-size: 1rem;
}

.flow-node span {
    font-size: 0.8rem;
    background: #e9ecef;
    padding: 3px 6px;
    display: block;
    margin-top: 6px;
    color: #495057;
    border-radius: 3px;
    font-family: var(--font-mono);
}

.flow-arrow {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-weight: bold;
    color: #868e96;
    padding-top: 24px;
}

.flow-arrow small {
    font-size: 0.75rem;
    color: #d32f2f;
    margin-bottom: -5px;
    display: block;
    font-weight: 600;
}

.flow-arrow::after {
    content: '→';
    font-size: 1.5rem;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-btn {
    border: 1px solid #ced4da;
    background: #fff;
    padding: 5px 12px;
    font-family: var(--font-sans);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    color: #495057;
    border-radius: 20px;
    transition: all 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
    background: #343a40;
    color: #fff;
    border-color: #343a40;
}

/* Quick Links (Top) */
.quick-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-bottom: 24px;
    align-items: center;
    border: 1px solid #dee2e6;
}

.quick-link-item {
    font-size: 0.9rem;
    font-weight: 600;
    color: #0056b3;
    padding: 2px 6px;
}

/* Search Dropdown */
.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 2px solid #495057;
    border-top: none;
    z-index: 2000;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.search-item {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid #f1f3f5;
    color: #212529;
}

.search-item:hover {
    background: #0056b3;
    color: #fff;
    text-decoration: none;
}

/* Mobile */
@media (max-width: 850px) {
    .page-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
    }

    .container {
        padding: 0 16px;
    }

    h1 {
        font-size: 1.5rem;
    }

    table {
        font-size: 13px;
    }
}