:root {
  --page: #edf2f8;
  --surface: #f6f8fb;
  --paper: #fff;
  --ink: #162339;
  --muted: #52647e;
  --border: #d8e1ed;
  --accent: #335bab;
  --shadow: 0 4px 12px rgb(22 35 57 / 4%);
  --radius: 20px;
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-height: 100vh; margin: 0; display: flex; flex-direction: column; }
button, input, select, textarea { font: inherit; }
input, select, textarea { width: 100%; min-width: 0; padding: .7rem .85rem; color: inherit; background: var(--paper); border: 1px solid #b9c7db; border-radius: 12px; }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
button { min-height: 42px; padding: .55rem .9rem; color: var(--accent); background: var(--paper); border: 1px solid #b9c7db; border-radius: 12px; cursor: pointer; font-weight: 650; }
button:disabled { opacity: .5; cursor: default; }
label { display: grid; gap: .35rem; font-size: .92rem; font-weight: 620; }
h1 { margin: .4em 0 .65em; font-size: clamp(1.65rem, 3.7vw, 2.4rem); line-height: 1.18; letter-spacing: -.035em; overflow-wrap: anywhere; }
h2 { margin: 0; font-size: 1.16rem; line-height: 1.35; }
p { line-height: 1.55; overflow-wrap: anywhere; }
a { color: var(--accent); }
summary { cursor: pointer; }
:focus-visible { outline: 3px solid #416cc7; outline-offset: 3px; }
svg { display: inline-block; width: 22px; height: 22px; vertical-align: middle; flex-shrink: 0; }
.top { background: var(--paper); border-bottom: 1px solid var(--border); }
.top-inner { max-width: 1320px; margin: auto; min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 24px; }
.brand { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 12px; }
.brand > img { width: 48px; height: 48px; object-fit: contain; }
.brand-copy { display: grid; gap: 2px; }
.brand strong { font-size: 1.25rem; letter-spacing: -.035em; }
.brand span { font-size: .73rem; color: var(--muted); }
.top nav, .top nav a, .top nav button { display: flex; align-items: center; gap: 7px; }
.top nav a { padding: 10px; text-decoration: none; font-weight: 650; }
.text-button { background: transparent; border: 0; }
.shell { width: min(100% - 40px, 990px); margin: 32px auto; }
main { min-width: 0; }
footer { margin-top: auto; padding: 25px 14px; text-align: center; font-size: .83rem; color: var(--muted); }
.skip { position: absolute; left: 12px; top: -200px; background: var(--paper); padding: 12px; z-index: 2; }
.skip:focus { top: 12px; }
.welcome { text-align: center; padding: 16px 0 24px; }
.welcome .search { margin-inline: auto; }
.eyebrow { margin-top: 26px; color: var(--muted); font-size: .76rem; font-weight: 750; letter-spacing: .1em; }
.search { display: flex; align-items: center; gap: 8px; width: min(100%, 620px); padding: 5px 5px 5px 14px; background: var(--paper); border: 1px solid var(--border); border-radius: 16px; }
.search svg { color: var(--muted); }
.search input { flex: 1; background: transparent; border: 0; }
.modules { margin: 26px auto; max-width: 730px; }
.between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 18px; }
.module-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 160px)); justify-content: center; gap: 20px; }
.module-link { min-width: 0; text-align: center; text-decoration: none; color: var(--ink); border-radius: var(--radius); }
.module-card { aspect-ratio: 1; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); transition: transform 160ms ease, border-color 160ms ease; }
.module-link:hover .module-card { transform: translateY(-2px); border-color: var(--module-dot); }
.module-icon { position: relative; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: var(--module-bg); color: var(--module-ink); }
.module-icon::after { content: ""; position: absolute; right: 1px; bottom: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--module-dot); }
.module-icon svg { width: 42px; height: 42px; }
.module-label { display: block; padding: 9px 0; font-size: .96rem; font-weight: 680; }
.theme-memo { --module-bg: #e8effb; --module-ink: #233f73; --module-dot: #4774c9; }
.theme-sop { --module-bg: #e5f2ee; --module-ink: #285b4b; --module-dot: #459c80; }
.theme-news { --module-bg: #fff0e4; --module-ink: #884b29; --module-dot: #dc8747; }
.theme-payroll { --module-bg: #eee9fa; --module-ink: #49387d; --module-dot: #8563cc; }
.panel { padding: clamp(16px, 3vw, 26px); background: var(--paper); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.primary { color: white; background: var(--accent); border-color: var(--accent); }
.notice { border: 1px solid #b9cbe7; border-radius: 12px; background: #f6faff; padding: 12px 14px; }
.notice.error { color: #852d2d; background: #fff5f4; border-color: #e4b9b9; }
.auth-panel { max-width: 450px; margin: 18px auto; }
.auth-links { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 18px; font-size: .85rem; }
.tabs { display: flex; gap: 18px; padding-bottom: 8px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.tabs a { padding: 7px 0; text-decoration: none; font-weight: 650; }
.tabs a[aria-current="page"] { color: var(--ink); box-shadow: 0 2px var(--accent); }
.wrapping { flex-wrap: wrap; }
.hint, .muted { color: var(--muted); }
.hint { font-size: .86rem; margin: .35em 0; }
.stack { display: grid; gap: 14px; }
.stack > button { justify-self: start; }
.auth-panel .stack > button { justify-self: stretch; }
.password-field { display: flex; align-items: center; gap: 5px; }
.password-field input { flex: 1; }
.back { display: inline-block; margin-bottom: 6px; }
.files { display: grid; gap: 12px; margin-top: 18px; }
.file { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: start; gap: 14px; text-decoration: none; color: inherit; }
.file small, .file p { color: var(--muted); }
.file p { margin: 5px 0; overflow-wrap: anywhere; }
.file:hover { border-color: var(--accent); }
.admin-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; width: min(100% - 42px, 1320px); margin: 28px auto; }
.side nav { display: grid; gap: 4px; }
.side nav a { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.side nav a:hover { background: var(--paper); }
.form-grid, .columns, .stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { display: grid; gap: 8px; color: var(--ink); text-decoration: none; }
.metric strong { font-size: 1.9rem; }
.inline { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.document-actions a { display: inline-flex; align-items: center; min-height: 38px; padding: .45rem .75rem; border: 1px solid #b9c7db; border-radius: 10px; color: var(--accent); text-decoration: none; font-size: .85rem; font-weight: 650; transition: border-color 200ms ease, background-color 200ms ease; }
.document-actions a:hover { border-color: var(--accent); background: #f1f5fc; }
.document-actions { align-items: center; justify-content: flex-end; }
.documents-table th:last-child { text-align: right; }
.document-actions form { margin: 0; }
.document-actions button { min-height: 38px; padding: .45rem .75rem; font-size: .85rem; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
fieldset { border: 1px solid var(--border); border-radius: 12px; min-width: 0; }
.table-panel { overflow: auto; margin: 18px 0; border: 1px solid var(--border); border-radius: 14px; background: var(--paper); }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
th { background: var(--surface); }
td form { margin-top: 6px; }
.code-line { font-size: clamp(1rem, 5vw, 1.45rem); overflow-wrap: anywhere; }
.viewer-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; position: sticky; top: 0; padding: 9px; background: var(--paper); border: 1px solid var(--border); border-radius: 14px; z-index: 1; }
#page-count { min-width: 60px; text-align: center; font-variant-numeric: tabular-nums; }
.canvas { overflow: auto; padding: clamp(6px, 2vw, 20px); background: #dbe4f0; border-radius: 14px; }
.canvas img { display: block; width: 100%; margin: auto; background: white; }
.canvas img[data-zoom="-1"] { width: 80%; }
.canvas img[data-zoom="1"] { width: 125%; }
.canvas img[data-zoom="2"] { width: 150%; }
.canvas img[data-zoom="3"] { width: 175%; }
.canvas img[data-zoom="4"] { width: 200%; }

@keyframes page-reveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes header-reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: no-preference) {
  .top { animation: header-reveal 400ms ease-out both; }
  main > :not(.viewer) { animation: page-reveal 480ms cubic-bezier(.22, 1, .36, 1) both; }
  main > :nth-child(2):not(.viewer) { animation-delay: 45ms; }
  main > :nth-child(3):not(.viewer) { animation-delay: 90ms; }
  .module-link { animation: page-reveal 500ms cubic-bezier(.22, 1, .36, 1) both; }
  .module-link:nth-child(2) { animation-delay: 55ms; }
  .module-link:nth-child(3) { animation-delay: 110ms; }
  .module-link:nth-child(4) { animation-delay: 165ms; }
  button, .side nav a, .top nav a, .tabs a, .file, .metric, .module-card, .module-icon,
  input, select, textarea { transition: background-color 200ms ease, border-color 200ms ease,
    box-shadow 220ms ease, color 200ms ease, transform 220ms ease; }
  input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(51 91 171 / 10%); }
  .side nav a:hover { color: var(--accent); transform: translateX(3px); }
  .module-link:hover .module-card, .module-link:focus-visible .module-card {
    transform: translateY(-4px); box-shadow: 0 12px 24px rgb(22 35 57 / 10%);
  }
  .module-link:hover .module-icon { transform: scale(1.05); }
  .metric:hover, .file:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgb(22 35 57 / 8%); }
  button:not(:disabled):hover { border-color: var(--accent); }
  button.primary:not(:disabled):hover { background: #284c94; box-shadow: 0 6px 14px rgb(51 91 171 / 22%); }
  button:not(:disabled):active { transform: translateY(1px); }
  tbody tr { transition: background-color 180ms ease; }
  tbody tr:hover { background-color: #f6f9fe; }
}
@media (max-width: 760px) {
  .module-grid { grid-template-columns: repeat(2, minmax(0, 160px)); gap: 14px; }
  .admin-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .side nav { display: flex; flex-wrap: wrap; }
  .side nav a { background: var(--paper); font-size: .8rem; }
  .form-grid, .columns, .stats { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .top-inner { padding-inline: 14px; }
  .top nav a, .top nav button { padding-inline: 5px; font-size: .8rem; }
  .top nav svg { width: 17px; height: 17px; }
  .shell, .admin-layout { width: calc(100% - 24px); }
}
@media (prefers-reduced-motion: reduce) {
  .module-card { transition: none; }
}
@media print {
  .viewer { display: none; }
}
