.admin-body { background: #f8f9fb; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: #fff; padding: 0 28px; }
.admin-topbar .brand { padding: 0; height: 76px; min-height: 76px; }
.admin-top-actions { display: flex; align-items: center; gap: 22px; }
.admin-top-actions a { text-decoration: none; }
.admin-main { width: min(1180px, 100%); margin: 0 auto; padding: 46px 34px 35px; }
.admin-workspace { display: grid; grid-template-columns: 205px minmax(0, 1fr); gap: 48px; }
.settings-nav { display: flex; flex-direction: column; align-self: start; gap: 7px; position: sticky; top: 24px; }
.settings-nav > .eyebrow { margin: 8px 12px 14px; }
.settings-nav a { display: flex; align-items: center; gap: 10px; padding: 12px; text-decoration: none; color: var(--muted); font-size: 12px; border-radius: 6px; }
.settings-nav a svg { width: 16px; height: 16px; flex-shrink: 0; }
.settings-nav a[aria-current="page"] { color: var(--green); background: #eaf2ed; font-weight: 600; }
.settings-nav a:hover { background: #eef2f0; }
.settings-nav a:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.settings-content { min-width: 0; }
.prompt-label { display: block; font-size: 13px; font-weight: 600; }
.prompt-editor { width: 100%; min-height: 350px; resize: vertical; margin-top: 16px; padding: 18px; font-size: 13px; font-family: inherit; line-height: 1.85; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: inherit; }
.prompt-editor:focus { outline: 2px solid #9fbda9; outline-offset: 1px; }
.prompt-count { text-align: right; }
.prompt-rules { padding: 16px 18px; margin: 22px 0; background: #eff4f1; border-radius: 6px; font-size: 12px; }
.prompt-rules strong { color: var(--green); font-weight: 600; }
.prompt-rules p { color: var(--muted); margin-top: 7px; line-height: 1.8; }
.prompt-outline { font-size: 12px; margin-top: 20px; color: var(--muted); }
.prompt-outline summary { cursor: pointer; }
.prompt-outline ol { padding-left: 22px; line-height: 1.9; margin-top: 12px; }
.text-button { background: transparent; border: 0; font-size: 11px; color: var(--muted); cursor: pointer; }
.auth-view { max-width: 420px; margin: 35px auto; }
.auth-view > .package-icon { margin-bottom: 23px; width: 44px; height: 46px; }
.auth-view .eyebrow { margin-bottom: 9px; }
.admin-description { font-size: 13px; color: var(--muted); margin-top: 11px; line-height: 1.8; }
#authForm { margin-top: 28px; }
#authForm .field { display: block; margin-top: 18px; }
#authForm .button { width: 100%; margin-top: 8px; }
.admin-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.admin-heading h1 { margin-top: 7px; }
.connection-status { display: inline-flex; align-items: center; gap: 7px; margin-top: 9px; padding: 6px 10px; border: 1px solid var(--line); background: #fff; border-radius: 5px; color: #7a848c; font-size: 11px; flex-shrink: 0; }
.connection-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #a9afb3; }
.connection-status.connected { color: var(--green); border-color: #cfe3d5; }
.connection-status.connected::before { background: var(--green); }
.settings-section { padding: 26px 0 14px; border-top: 1px solid var(--line); }
.settings-section-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 23px; }
.settings-section-heading h2 { font-size: 15px; font-weight: 600; }
.settings-section-heading svg { color: #718c7b; width: 17px; }
.settings-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); align-items: start; gap: 45px; margin-bottom: 27px; }
.settings-row label, .settings-row strong { font-size: 12px; font-weight: 550; }
.settings-row p { font-size: 11px; color: #818a92; line-height: 1.8; margin-top: 5px; }
.settings-row input, .settings-row select { font-size: 13px; }
.password-field { display: flex; align-items: center; position: relative; }
.password-field input { padding-right: 43px; }
.password-field .icon-button { position: absolute; right: 6px; }
.field-note { display: block; font-size: 11px; color: #8a949b; margin-top: 7px; line-height: 1.7; }
.model-fields { display: grid; gap: 9px; }
.model-fields .field-note { margin: 0; }
.model-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.checkbox-label { display: inline-flex; align-items: center; gap: 6px; font-size: 11px !important; color: var(--muted); font-weight: 400 !important; }
.checkbox-label input { min-height: 14px; width: 14px; accent-color: var(--green); }
.switch-label { display: inline-flex; align-items: center; gap: 10px; margin-top: 3px; }
.switch-label input { appearance: none; width: 35px; min-height: 21px; height: 21px; border: 0; padding: 0; border-radius: 12px; background: #d3d9dd; cursor: pointer; position: relative; }
.switch-label input::after { content: ''; width: 15px; height: 15px; border-radius: 50%; background: #fff; position: absolute; top: 3px; left: 3px; transition: transform 140ms; }
.switch-label input:checked { background: var(--green); }
.switch-label input:checked::after { transform: translateX(14px); }
.switch-label input:focus-visible { outline: 3px solid #9fbda9; outline-offset: 3px; }
.limit-input { max-width: 125px; }
.settings-actions { display: flex; align-items: center; gap: 18px; padding: 21px 0; border-top: 1px solid var(--line); }
.settings-actions .field-note { margin: 0 0 0 auto; }
.text-danger { padding: 8px 0; background: transparent; border: 0; color: #a65f54; font-size: 11px; }
.form-message { min-height: 0; font-size: 12px; color: #a04d42; line-height: 1.8; }
.form-message:not(:empty) { padding: 12px 14px; background: #fff2ee; border-radius: 6px; margin: 15px 0; }
.form-message.success { background: #edf6ef; color: #387652; }
.test-result { margin: 0 0 16px; padding: 18px 20px; border-left: 3px solid #8eafa0; background: #eff5f1; }
.test-result h3 { font-size: 15px; font-weight: 550; margin: 9px 0; }
.test-result p { font-size: 12px; color: #667b70; line-height: 1.8; }
.usage-section { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 24px; }
.usage-section h2 { font-size: 13px; font-weight: 550; }
.usage-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 22px; }
.usage-grid > div { border-right: 1px solid var(--line); padding-left: 25px; }
.usage-grid > div:first-child { padding-left: 0; }
.usage-grid > div:last-child { border: 0; }
.usage-grid span { display: block; font-size: 11px; color: #8a959c; }
.usage-grid strong { display: block; font-size: 25px; font-weight: 550; margin-top: 7px; }
.admin-footer { display: flex; gap: 8px; align-items: center; font-size: 10px; color: #9aa2a8; margin-top: 33px; }
.admin-footer svg { width: 14px; }
.admin-body button:disabled { opacity: .5; cursor: not-allowed; }
.advanced-settings { border-top: 1px solid var(--line); padding: 18px 0 24px; margin-bottom: 18px; }
.advanced-settings summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.advanced-settings[open] summary { margin-bottom: 22px; }
.advanced-settings > .button { margin-left: auto; display: flex; }
#modelSummary { color: #496e62; overflow-wrap: anywhere; }
.prompt-editor.common-prompt { min-height: 190px; }
.library-section { margin-top: 36px; border-top: 1px solid #e2e7e4; padding-top: 24px; }
.library-heading, .library-selection { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.library-heading h2 { font-size: 15px; font-weight: 550; }
.library-selection label { font-size: 14px; font-weight: 550; }
.prompt-library-layout { display: grid; grid-template-columns: minmax(150px, 210px) minmax(0, 1fr); gap: 22px; }
.library-tree { display: flex; flex-direction: column; gap: 3px; max-height: 650px; overflow-y: auto; padding-right: 6px; align-self: start; }
.library-node { text-align: left; background: transparent; border: 0; border-radius: 6px; padding: 10px; color: #586660; font: inherit; font-size: 12px; line-height: 1.5; cursor: pointer; overflow-wrap: anywhere; }
.library-node[aria-pressed="true"] { background: #eaf2ec; color: #24523d; }
.library-node:focus-visible { outline: 2px solid #4d7d61; outline-offset: -2px; }
.library-child { padding-left: 23px; font-size: 11px; }
.library-node.has-edits::after { content: ' •'; color: #a16a2b; }
.library-origin { padding: 3px 8px; border-radius: 4px; background: #f0f3ef; color: #557060; font-size: 10px; }
.library-editor { min-width: 0; }
.library-editor .prompt-editor { min-height: 280px; }
.library-example { font-size: 12px; line-height: 1.7; margin: 10px 0; color: #53685b; }
.library-history, .compiled-library { margin: 20px 0; font-size: 12px; }
.library-history summary, .compiled-library summary { cursor: pointer; color: #557060; line-height: 1.7; }
.library-history select { margin: 10px 0; }
.library-history pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.7; max-height: 340px; overflow-y: auto; }
.library-preview-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 18px 0; }
.library-preview-options label { min-width: 0; line-height: 1.8; }
#compiledLibraryPrompt { min-height: 300px; font-size: 11px; }
@media (max-width: 900px) { .prompt-library-layout { grid-template-columns: 1fr; } .library-tree { max-height: 240px; border-bottom: 1px solid #e2e7e4; padding-bottom: 12px; } }
@media (max-width: 480px) { .library-preview-options { grid-template-columns: 1fr; } .library-heading { align-items: start; } }
@media (max-width: 640px) {
  .admin-workspace { grid-template-columns: 1fr; gap: 28px; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .settings-nav > .eyebrow { width: 100%; margin: 0 0 9px; }
  .settings-nav a { padding: 10px; font-size: 11px; }
  .prompt-editor { min-height: 360px; padding: 14px; }
  .admin-topbar { padding: 0 20px; flex-wrap: wrap; gap: 0; }
  .admin-topbar .brand { min-height: 63px; height: 63px; }
  .admin-top-actions { gap: 15px; padding-bottom: 12px; }
  .admin-top-actions .button { min-height: 33px; }
  .admin-main { padding: 30px 22px; }
  .admin-heading { flex-direction: column; gap: 7px; }
  .settings-row { grid-template-columns: 1fr; gap: 12px; }
  .settings-actions { flex-wrap: wrap; gap: 12px; }
  .settings-actions .button { margin-left: auto; }
  .settings-actions .field-note { order: 3; width: 100%; text-align: right; }
  .admin-footer { align-items: flex-start; }
  .usage-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 0; }
  .usage-grid > div:nth-child(odd) { padding-left: 0; }
  .usage-grid > div:nth-child(even) { border-right: 0; }
}
