@page {
  size: A4;
  margin: 2.1cm 1.9cm 2.2cm 1.9cm;
  @bottom-center {
    content: counter(page);
    font-family: 'DejaVu Sans', sans-serif;
    font-size: 9pt;
    color: #6b7280;
  }
  @top-center {
    content: "Applied AI Engineer — Complete Graduate Study Guide";
    font-family: 'DejaVu Sans', sans-serif;
    font-size: 8pt;
    color: #9ca3af;
    letter-spacing: 0.5px;
  }
}
@page cover {
  margin: 0;
  @top-center { content: none; }
  @bottom-center { content: none; }
}
@page toc {
  @top-center { content: none; }
}

* { box-sizing: border-box; }

body {
  font-family: 'DejaVu Sans', 'Noto Sans', sans-serif;
  font-size: 10.3pt;
  line-height: 1.5;
  color: #1f2933;
}

.cover-page {
  page: cover;
  height: 100vh;
  background: linear-gradient(160deg, #0f2027 0%, #14323f 45%, #0d5c63 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 5cm 2.4cm;
  break-after: page;
}
.cover-kicker {
  font-size: 12pt;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: #7fe3d8;
  margin-bottom: 0.6cm;
  font-weight: 700;
}
.cover-title {
  font-size: 40pt;
  font-weight: 700;
  line-height: 1.1;
  margin: 0 0 0.4cm 0;
}
.cover-subtitle {
  font-size: 15pt;
  color: #d7ece9;
  max-width: 13cm;
  margin-bottom: 1.4cm;
}
.cover-tags {
  font-size: 10.5pt;
  color: #9adbd2;
  border-top: 1px solid rgba(255,255,255,0.25);
  padding-top: 0.5cm;
  max-width: 14cm;
}
.cover-meta {
  position: absolute;
  bottom: 2.2cm;
  font-size: 9.5pt;
  color: #b8d8d3;
}

.toc-page { page: toc; break-after: page; }
h1.toc-heading { color: #0d5c63; font-size: 22pt; margin-bottom: 0.7cm; }
table.toc-table { width: 100%; border-collapse: collapse; font-size: 10.3pt; }
table.toc-table td { padding: 5px 0; border-bottom: 1px dotted #cbd5c0; }
table.toc-table td.toc-num { width: 0.9cm; color: #0d5c63; font-weight: 700; }
table.toc-table td.toc-page { width: 1.4cm; text-align: right; color: #6b7280; }
.chapter-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  margin-top: 0.6cm;
}
.chapter-links a {
  color: #0d5c63;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: 4px;
  padding: 8px 10px;
  text-decoration: none;
}
.chapter-links a:hover, .chapter-links a:focus {
  background: #d9f2ee;
  text-decoration: underline;
}

.part-divider {
  break-before: page;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #0d5c63;
  color: white;
  margin: -2.1cm -1.9cm -2.2cm -1.9cm;
  padding: 0 3cm;
}
.part-divider .part-label { font-size: 13pt; letter-spacing: 3px; color: #9adbd2; text-transform: uppercase; }
.part-divider h1 { font-size: 30pt; color: white; border: none; margin-top: 0.3cm; }

h1 {
  font-size: 20pt;
  color: #0d5c63;
  border-bottom: 3px solid #0d5c63;
  padding-bottom: 0.15cm;
  margin-top: 0;
  break-before: page;
}
h1.no-break { break-before: auto; }
h2 {
  font-size: 14pt;
  color: #0f766e;
  margin-top: 0.9cm;
  border-left: 5px solid #14b8a6;
  padding-left: 0.25cm;
}
h3 {
  font-size: 11.5pt;
  color: #134e4a;
  margin-top: 0.55cm;
}
p { margin: 0.28cm 0; text-align: justify; }
ul, ol { margin: 0.2cm 0 0.35cm 0; padding-left: 0.6cm; }
li { margin-bottom: 0.12cm; }
strong { color: #0d5c63; }
code, .code-inline {
  font-family: 'DejaVu Sans Mono', monospace;
  background: #eef2f0;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 9.3pt;
  color: #0d5c63;
}
pre {
  background: #0f2027;
  color: #d1fae5;
  padding: 0.35cm 0.4cm;
  border-radius: 5px;
  font-family: 'DejaVu Sans Mono', monospace;
  font-size: 8.6pt;
  line-height: 1.4;
  white-space: pre-wrap;
  break-inside: avoid;
  margin: 0.3cm 0;
}
.diagram {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-left: 4px solid #0d9488;
  border-radius: 4px;
  padding: 0.3cm 0.4cm;
  font-family: 'DejaVu Sans Mono', monospace;
  font-size: 8.6pt;
  line-height: 1.45;
  white-space: pre-wrap;
  break-inside: avoid;
  margin: 0.3cm 0;
  color: #0f2027;
}
.diagram-caption {
  font-size: 8.8pt;
  color: #0f766e;
  font-style: italic;
  margin-top: -0.15cm;
  margin-bottom: 0.3cm;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.3cm 0 0.4cm 0;
  font-size: 9.3pt;
  break-inside: avoid;
}
table.data-table th {
  background: #0d5c63;
  color: white;
  text-align: left;
  padding: 5px 7px;
}
table.data-table td {
  padding: 5px 7px;
  border-bottom: 1px solid #e2e8e6;
  vertical-align: top;
}
table.data-table tr:nth-child(even) td { background: #f5faf9; }

.box {
  border-radius: 5px;
  padding: 0.3cm 0.4cm;
  margin: 0.35cm 0;
  break-inside: avoid;
  font-size: 9.8pt;
}
.sticky {
  background: #fff8db;
  border: 1px solid #f2d675;
  border-left: 5px solid #eab308;
  position: relative;
}
.sticky .box-title { color: #92650a; font-weight: 700; margin-bottom: 0.12cm; display: block; }
.tip {
  background: #eff6ff;
  border-left: 5px solid #3b82f6;
}
.tip .box-title { color: #1d4ed8; font-weight: 700; display: block; margin-bottom: 0.12cm; }
.mistake {
  background: #fef2f2;
  border-left: 5px solid #ef4444;
}
.mistake .box-title { color: #b91c1c; font-weight: 700; display: block; margin-bottom: 0.12cm; }
.warn {
  background: #fff7ed;
  border-left: 5px solid #f97316;
}
.warn .box-title { color: #c2410c; font-weight: 700; display: block; margin-bottom: 0.12cm; }
.exit {
  background: #f0fdf4;
  border-left: 5px solid #22c55e;
}
.exit .box-title { color: #15803d; font-weight: 700; display: block; margin-bottom: 0.12cm; }

.qa { margin: 0.25cm 0; break-inside: avoid; }
.qa .q { font-weight: 700; color: #0d5c63; }
.qa .a { margin-left: 0.15cm; color: #374151; }

.summary-box {
  background: #ecfdf5;
  border: 1px solid #86efac;
  border-radius: 5px;
  padding: 0.35cm 0.45cm;
  margin-top: 0.5cm;
  break-inside: avoid;
}
.summary-box h3 { margin-top: 0; color: #166534; }

.chip-row { margin: 0.15cm 0 0.3cm 0; }
.chip {
  display: inline-block;
  background: #d9f2ee;
  color: #0d5c63;
  border-radius: 10px;
  padding: 2px 9px;
  font-size: 8.6pt;
  margin: 2px 3px 2px 0;
}

.two-col { display: flex; gap: 0.5cm; }
.two-col > div { flex: 1; }

.glossary dt { font-weight: 700; color: #0d5c63; margin-top: 0.22cm; }
.glossary dd { margin-left: 0; margin-bottom: 0.1cm; color: #374151; }

.small-note { font-size: 8.8pt; color: #6b7280; font-style: italic; }
