@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@500;600;700;800&family=Mulish:wght@400;500;600;700;800&display=swap");

* { box-sizing: border-box; }
:root {
  --ink: #16273F; --body: #33404F; --muted: #8791A0; --muted2: #5B6675; --muted3: #98A2B0;
  --card-border: #EAEDF3; --panel-border: #E7EBF1; --cyan: #2FA8C9; --cyan-tint: #E4F5F9; --red: #E8402A;
}
html, body { margin: 0; padding: 0; }
body { min-height: 100vh; font-family: "Mulish", system-ui, sans-serif; color: var(--body); background: linear-gradient(180deg, #F5F3FB 0%, #F1F6F6 100%); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
body.auth-pending .app-shell { display: none; }
.app-shell .rm-header-inner, .app-shell .rm-footer-inner { max-width: 90%; }
@keyframes okfFadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.okf-hero-inner { max-width: 90%; margin: 0 auto; padding: 30px 32px 4px; }
.okf-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 38px; line-height: 1.05; letter-spacing: -0.5px; color: var(--ink); margin: 0 0 6px; }
.okf-url { font-size: 15.5px; color: var(--muted2); padding-bottom: 8px; }
.okf-main { flex: 1; max-width: 90%; width: 100%; margin: 0 auto; padding: 24px 32px 56px; }
.okf-panel { animation: okfFadeUp 0.35s ease both; display: flex; flex-direction: column; gap: 24px; }
.okf-notice { background: #fff; border: 1px solid var(--card-border); border-radius: 18px; box-shadow: 0 4px 16px rgba(18,38,63,0.05); padding: 56px 20px; text-align: center; color: var(--muted); font-size: 15px; }

/* Overview */
.okf-overview { background: #fff; border: 1px solid var(--card-border); border-radius: 20px; box-shadow: 0 4px 16px rgba(18,38,63,0.05); padding: 24px 26px; display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1.4fr) auto; gap: 26px; align-items: center; }
.okf-ov-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted3); }
.okf-ov-scan { font-family: ui-monospace, Menlo, monospace; font-size: 14px; color: var(--ink); margin-top: 6px; word-break: break-all; }
.okf-ov-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.okf-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.okf-stat { background: #F8FAFC; border: 1px solid #EEF1F6; border-radius: 12px; padding: 12px 14px; text-align: center; }
.okf-stat-value { font-family: "Poppins", sans-serif; font-weight: 800; font-size: 22px; color: var(--ink); }
.okf-stat-label { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-top: 4px; }
.okf-ov-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.okf-badge { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 11.5px; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.okf-badge.ok { color: #1F8A5B; background: #E7F7F1; border: 1px solid #CDEDE1; }
.okf-badge.bad { color: #D14545; background: #FCECEC; border: 1px solid #F5D5D5; }
.okf-badge.warn { color: #B5772E; background: #FCF6E4; border: 1px solid #F1E7C4; }
.okf-download { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; font-family: "Poppins", sans-serif; font-weight: 700; font-size: 13.5px; color: #fff; background: var(--cyan); border-radius: 10px; padding: 9px 16px; text-decoration: none; }
.okf-download:hover { background: #2691AE; }

/* Grid: tree + viewer */
.okf-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.okf-tree { background: #fff; border: 1px solid var(--card-border); border-radius: 16px; box-shadow: 0 4px 16px rgba(18,38,63,0.05); padding: 14px 12px; position: sticky; top: 16px; max-height: calc(100vh - 40px); overflow: auto; }
.okf-tree-head { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); padding: 4px 8px 10px; }
.okf-treelist { font-size: 13px; }
.okf-dir { display: flex; align-items: center; gap: 6px; font-family: "Poppins", sans-serif; font-weight: 700; font-size: 12.5px; color: var(--muted2); padding: 5px 8px; }
.okf-dirchildren { margin-left: 12px; border-left: 1px solid #EEF1F6; padding-left: 6px; }
.okf-file { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; background: none; border: none; color: var(--body); padding: 5px 8px; border-radius: 7px; }
.okf-file:hover { background: #F5F8FB; color: var(--cyan); }
.okf-file.is-active { background: var(--cyan-tint); color: #1E7E97; font-weight: 700; }
.okf-file.reserved { color: var(--muted3); font-style: italic; }

.okf-viewer { background: #fff; border: 1px solid var(--card-border); border-radius: 16px; box-shadow: 0 4px 16px rgba(18,38,63,0.05); min-height: 320px; }
.okf-viewer-empty { padding: 60px 24px; text-align: center; color: var(--muted); }
.okf-viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid #F1F4F8; }
.okf-viewer-path { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--ink); word-break: break-all; }
.okf-rawtoggle { font-family: "Poppins", sans-serif; font-weight: 600; font-size: 12px; color: var(--muted2); background: #F4F6FA; border: 1px solid #E4E8EF; border-radius: 8px; padding: 5px 12px; }
.okf-rawtoggle:hover { border-color: var(--cyan); color: var(--cyan); }
.okf-fm { margin: 14px 20px; background: #F8FAFC; border: 1px solid #EEF1F6; border-radius: 12px; padding: 6px 14px; }
.okf-fm-row { display: grid; grid-template-columns: 160px 1fr; gap: 12px; padding: 5px 0; border-bottom: 1px solid #F1F4F8; font-size: 13px; }
.okf-fm-row:last-child { border-bottom: none; }
.okf-fm-key { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 12px; color: var(--muted2); }
.okf-fm-val { color: var(--body); word-break: break-word; }
.okf-body { padding: 4px 24px 24px; line-height: 1.65; }
.okf-body h1, .okf-body h2, .okf-body h3, .okf-body h4 { font-family: "Poppins", sans-serif; color: var(--ink); line-height: 1.25; margin: 20px 0 8px; }
.okf-body h1 { font-size: 24px; } .okf-body h2 { font-size: 20px; } .okf-body h3 { font-size: 17px; }
.okf-body p { margin: 8px 0; }
.okf-body ul, .okf-body ol { margin: 8px 0; padding-left: 24px; }
.okf-body li { margin: 3px 0; }
.okf-body a { color: #2F6FE0; }
.okf-body code { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; background: #EEF1F6; padding: 1px 6px; border-radius: 5px; }
.okf-body pre, .okf-raw { background: #16273F; color: #E7ECF3; border-radius: 10px; padding: 14px 16px; overflow-x: auto; }
.okf-body pre code, .okf-raw { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.okf-raw { margin: 16px 20px; white-space: pre-wrap; word-break: break-word; }
.okf-body blockquote { border-left: 3px solid var(--cyan); margin: 10px 0; padding: 4px 14px; color: var(--muted2); background: #F8FAFC; }
.okf-body table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13.5px; }
.okf-body th, .okf-body td { border: 1px solid #E7EBF1; padding: 7px 10px; text-align: left; }
.okf-body th { background: #F8FAFD; font-family: "Poppins", sans-serif; font-weight: 700; }
.okf-body img { max-width: 100%; border-radius: 8px; }

/* History */
.okf-history { background: #fff; border: 1px solid var(--card-border); border-radius: 16px; box-shadow: 0 4px 16px rgba(18,38,63,0.05); padding: 18px 20px; }
.okf-history-title { font-family: "Poppins", sans-serif; font-weight: 700; font-size: 15px; color: var(--ink); margin-bottom: 12px; }
.okf-history-list { display: flex; flex-direction: column; gap: 8px; }
.okf-snap { display: flex; justify-content: space-between; gap: 12px; text-align: left; background: #F8FAFC; border: 1px solid #EEF1F6; border-radius: 10px; padding: 10px 14px; }
.okf-snap.is-active { border-color: var(--cyan); background: var(--cyan-tint); }
.okf-snap-id { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; color: var(--ink); }
.okf-snap-meta { font-size: 12.5px; color: var(--muted); }

@media (max-width: 1000px) {
  .okf-overview { grid-template-columns: 1fr; }
  .okf-grid { grid-template-columns: 1fr; }
  .okf-tree { position: static; max-height: 320px; }
}
@media (max-width: 640px) { .okf-hero-inner, .okf-main { padding-left: 20px; padding-right: 20px; } .okf-stats { grid-template-columns: repeat(2, 1fr); } }
