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

:root {
  --white: #ffffff;
  --bg: #f2f2f2;
  --black: #111111;
  --text: #1a1a1a;
  --text-secondary: #4a4a4a;
  --border: #c2c2c2;
  --border-light: #dedede;
  --red: #b83028;
  --red-bg: #fcefee;
  --red-border: #dbb0ac;
  --green: #1a7030;
  --green-bg: #edf8f1;
  --accent: #2c3e50;
  --accent-light: #eef1f3;
  --radius: 6px;
  --shadow: 0 1px 4px rgba(0,0,0,0.11);
  --shadow-md: 0 2px 10px rgba(0,0,0,0.13);
  --font: 'Newsreader', 'Georgia', serif;
  --font-ui: 'DM Sans', 'Helvetica Neue', sans-serif;
  --nav-height: 56px;
  --max-w: 860px;
}

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Newsreader:opsz,wght@6..72,400;6..72,500;6..72,600&display=swap');

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-height) + 16px); }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.7; font-size: 16px; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }

/* NAV */
#main-nav { position: sticky; top: 0; z-index: 100; background: var(--white); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 20px 0 20px; height: var(--nav-height); box-shadow: var(--shadow); }
.nav-brand { display: flex; align-items: center; gap: 10px; cursor: pointer; text-decoration: none; flex-shrink: 0; padding-right: 20px; margin-right: 4px; border-right: 1px solid var(--border-light); }
.nav-logo-img { width: 38px; height: 38px; object-fit: contain; display: block; flex-shrink: 0; }
.nav-brand-text { display: flex; flex-direction: column; line-height: 1; }
.nav-brand-name { font-family: var(--font-ui); font-weight: 700; font-size: 15px; color: var(--black); letter-spacing: -0.2px; }
.nav-brand-sub  { font-family: var(--font-ui); font-size: 9.5px; font-weight: 500; color: var(--text-secondary); letter-spacing: 0.5px; text-transform: uppercase; margin-top: 3px; }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 10px; font-size: 18px; cursor: pointer; color: var(--text); }
.nav-links { list-style: none; display: flex; gap: 2px; align-items: center; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; flex-shrink: 1; min-width: 0; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { font-family: var(--font-ui); font-size: 12px; font-weight: 500; padding: 5px 9px; border-radius: var(--radius); color: var(--text-secondary); transition: all 0.15s; display: flex; align-items: center; gap: 4px; white-space: nowrap; text-decoration: none; }
.nav-links a:hover { background: var(--accent-light); color: var(--text); }
.nav-links a.active { background: var(--black); color: var(--white); }
.nav-icon { font-size: 11px; }

@media (max-width: 960px) {
  .nav-toggle { display: block; }
  .nav-links { display: none; position: absolute; top: var(--nav-height); left: 0; right: 0; background: var(--white); flex-direction: column; padding: 8px 12px; gap: 2px; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-md); }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 14px; width: 100%; font-size: 14px; }
  .nav-brand-sub { display: none; }
  .nav-brand { border-right: none; padding-right: 0; }
}

@media (max-width: 400px) {
  .nav-logo-img { width: 30px; height: 30px; }
  .nav-brand-name { font-size: 13px; }
}

/* MAIN */
#app { min-height: calc(100vh - var(--nav-height)); padding: 32px 24px 64px; max-width: var(--max-w); margin: 0 auto; }

/* LOADING */
.loading-screen { text-align: center; padding: 80px 24px; }
.loading-logo { font-family: var(--font-ui); font-weight: 700; font-size: 36px; background: var(--black); color: var(--white); display: inline-block; padding: 8px 20px; border-radius: 8px; margin-bottom: 20px; letter-spacing: 2px; }
.loading-screen p { font-family: var(--font-ui); color: var(--text-secondary); margin-bottom: 20px; }
.loading-bar { width: 200px; height: 3px; background: var(--border); margin: 0 auto; border-radius: 2px; overflow: hidden; }
.loading-fill { width: 40%; height: 100%; background: var(--black); border-radius: 2px; animation: loadSlide 1.2s ease-in-out infinite; }
@keyframes loadSlide { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

/* HOME */
.view-home { text-align: center; }
.home-hero { padding: 40px 0 32px; }
.home-badge { font-family: var(--font-ui); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 2px; color: var(--text-secondary); margin-bottom: 16px; }
.home-hero h1 { font-size: 42px; font-weight: 600; letter-spacing: -0.5px; margin-bottom: 12px; }
.home-subtitle { font-size: 17px; color: var(--text-secondary); max-width: 480px; margin: 0 auto 24px; }
.home-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.btn { font-family: var(--font-ui); font-size: 14px; font-weight: 600; padding: 10px 24px; border-radius: var(--radius); cursor: pointer; border: 2px solid var(--black); transition: all 0.15s; display: inline-block; }
.btn-primary { background: var(--black); color: var(--white); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-outline { background: var(--white); color: var(--black); }
.btn-outline:hover { background: var(--black); color: var(--white); }
.home-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; margin: 28px 0 32px; text-align: left; }
.home-card { padding: 24px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); transition: all 0.15s; display: block; }
.home-card:hover { border-color: var(--black); box-shadow: var(--shadow-md); }
.card-icon { font-size: 22px; display: block; margin-bottom: 10px; }
.home-card h3 { font-family: var(--font-ui); font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.home-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.home-status { font-family: var(--font-ui); font-size: 12px; color: var(--green); display: flex; align-items: center; justify-content: center; gap: 8px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }

@media (max-width: 600px) {
  .home-hero h1 { font-size: 30px; }
  .home-grid { grid-template-columns: 1fr; }
  #app { padding: 20px 16px 48px; }
}

/* SEARCH BOX */
.search-box { position: relative; max-width: 500px; margin: 0 auto 8px; }
.search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--text-secondary); pointer-events: none; }
.search-input { width: 100%; font-family: var(--font-ui); font-size: 15px; padding: 12px 40px 12px 42px; border: 2px solid var(--border); border-radius: var(--radius); background: var(--white); color: var(--text); outline: none; transition: border-color 0.15s; }
.search-input:focus { border-color: var(--black); }
.search-input::placeholder { color: #aaa; }
.search-clear { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; font-size: 18px; color: var(--text-secondary); cursor: pointer; padding: 4px 8px; }
.search-clear.hidden { display: none; }

/* SEARCH RESULTS DROPDOWN */
.search-results { position: relative; max-width: 500px; margin: 0 auto; z-index: 80; display: none; }
.search-results.visible { display: block; }
.search-results .search-result-item { display: block; padding: 10px 16px; background: var(--white); border: 1px solid var(--border-light); border-top: none; font-family: var(--font-ui); font-size: 14px; color: var(--text); transition: background 0.1s; }
.search-results .search-result-item:first-child { border-top: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.search-results .search-result-item:last-child { border-radius: 0 0 var(--radius) var(--radius); }
.search-results .search-result-item:hover { background: var(--accent-light); }
.sr-name { font-weight: 500; }

/* CONTENT */
.section-title { font-size: 28px; font-weight: 600; margin-bottom: 24px; padding-bottom: 14px; border-bottom: 2px solid var(--black); }
.section-desc { color: var(--text-secondary); margin-bottom: 20px; font-size: 15px; font-family: var(--font-ui); }
.content-block { margin-bottom: 24px; padding: 24px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); }
.content-block h2 { font-family: var(--font-ui); font-size: 17px; font-weight: 600; margin-bottom: 12px; color: var(--black); }
.content-block p { color: var(--text); font-size: 15px; }
.content-note { margin-top: 16px; padding: 12px 16px; background: var(--accent-light); border-left: 3px solid var(--accent); border-radius: 0 var(--radius) var(--radius) 0; font-size: 13px; color: var(--text-secondary); font-family: var(--font-ui); }

/* HOW-TO-USE SECTION NAV */
.section-nav { position: sticky; top: var(--nav-height); z-index: 50; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 24px; display: flex; flex-wrap: wrap; gap: 4px; box-shadow: var(--shadow); }
.section-nav-link { font-family: var(--font-ui); font-size: 12px; font-weight: 500; padding: 5px 10px; border-radius: 4px; color: var(--text-secondary); transition: all 0.15s; white-space: nowrap; }
.section-nav-link:hover { background: var(--accent-light); color: var(--text); }
.section-nav-link.active { background: var(--black); color: var(--white); }

.detail-list { margin-top: 16px; }
.detail-item { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border-light); font-size: 14px; }
.detail-item:last-child { border-bottom: none; }
.detail-label { font-family: var(--font-ui); font-weight: 600; min-width: 120px; flex-shrink: 0; font-size: 13px; color: var(--accent); }
.detail-text { color: var(--text); line-height: 1.6; }

.subsection-title { font-family: var(--font-ui); font-size: 15px; font-weight: 600; margin: 20px 0 10px; color: var(--accent); }
.category-table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.cat-row { display: flex; gap: 16px; padding: 10px 14px; font-size: 14px; border-bottom: 1px solid var(--border-light); align-items: flex-start; }
.cat-row:last-child { border-bottom: none; }
.cat-header { background: var(--accent-light); font-family: var(--font-ui); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.cat-label { min-width: 50px; flex-shrink: 0; font-family: var(--font-ui); font-weight: 600; }
.cat-badge { background: var(--black); color: var(--white); padding: 1px 8px; border-radius: 3px; font-size: 12px; text-align: center; display: inline-block; min-width: 30px; }
.cat-desc { color: var(--text); line-height: 1.5; }

/* A-Z */
.az-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 6px; margin-bottom: 24px; }
.az-letter { font-family: var(--font-ui); font-weight: 600; font-size: 14px; padding: 8px 4px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); cursor: pointer; transition: all 0.15s; text-align: center; position: relative; }
.az-letter:hover:not(.disabled) { border-color: var(--black); background: var(--accent-light); }
.az-letter.selected { background: var(--black); color: var(--white); border-color: var(--black); }
.az-letter.selected .az-count { color: rgba(255,255,255,0.6); }
.az-letter.disabled { opacity: 0.3; cursor: default; }
.az-count { display: block; font-size: 10px; font-weight: 400; color: var(--text-secondary); margin-top: 2px; }
.az-result { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-height: 100px; }
.az-placeholder { color: var(--text-secondary); font-size: 14px; font-family: var(--font-ui); text-align: center; padding: 20px; }
.az-empty { color: var(--text-secondary); font-size: 14px; font-family: var(--font-ui); text-align: center; padding: 20px; }
.az-empty strong { font-size: 24px; display: block; margin-bottom: 8px; color: var(--black); }
.az-drug-list { }
.az-list-header { font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 1px; padding: 0 4px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.az-drug-item { display: flex; align-items: center; gap: 12px; padding: 12px 8px; border-bottom: 1px solid var(--border-light); transition: background 0.1s; cursor: pointer; }
.az-drug-item:last-child { border-bottom: none; }
.az-drug-item:hover { background: var(--accent-light); }
.drug-item-name { font-family: var(--font-ui); font-weight: 600; font-size: 14px; color: var(--black); min-width: 140px; flex-shrink: 0; }
.drug-item-ind { font-size: 13px; color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drug-item-arrow { color: var(--text-secondary); font-size: 14px; flex-shrink: 0; }

/* DRUG PAGE */
.view-drug { }
.drug-top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.drug-back { font-family: var(--font-ui); font-size: 14px; font-weight: 500; color: var(--text-secondary); padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius); transition: all 0.15s; }
.drug-back:hover { border-color: var(--black); color: var(--text); }
.drug-fav-btn { background: none; border: 2px solid var(--border); border-radius: var(--radius); font-size: 22px; padding: 4px 10px; cursor: pointer; color: var(--text-secondary); transition: all 0.15s; }
.drug-fav-btn:hover, .drug-fav-btn.is-fav { border-color: #d4a017; color: #d4a017; }
.drug-header { margin-bottom: 24px; }
.drug-header h1 { font-size: 30px; font-weight: 600; margin-bottom: 12px; }
.drug-forms { display: flex; flex-wrap: wrap; gap: 8px; }
.form-chip { font-family: var(--font-ui); font-size: 12px; background: var(--accent-light); border: 1px solid var(--border); padding: 5px 12px; border-radius: 20px; color: var(--text-secondary); }

/* QUICK VIEW */
.drug-quick { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 24px; overflow: hidden; }
.quick-row { display: flex; border-bottom: 1px solid var(--border-light); align-items: stretch; }
.quick-row:last-child { border-bottom: none; }
.quick-label { font-family: var(--font-ui); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); width: 130px; min-width: 130px; flex-shrink: 0; padding: 12px 14px; background: var(--accent-light); border-right: 1px solid var(--border-light); display: flex; align-items: flex-start; line-height: 1.4; word-break: break-word; }
.quick-value { padding: 12px 16px; flex: 1; min-width: 0; font-size: 14px; line-height: 1.6; word-wrap: break-word; overflow-wrap: break-word; }
.quick-danger { background: var(--red-bg); }
.quick-danger .quick-label { background: var(--red-bg); color: var(--red); border-right-color: var(--red-border); }
.quick-danger .quick-value { color: var(--red); }
.quick-danger .field-list li { color: var(--red); }
.quick-danger .field-list li::before { color: var(--red); }

.preg-badge { font-family: var(--font-ui); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 4px; margin-right: 8px; display: inline-block; }
.preg-badge.fda { background: var(--accent-light); border: 1px solid var(--border); }
.preg-badge.tga { background: var(--accent-light); border: 1px solid var(--border); }

.field-list { list-style: none; padding: 0; margin: 0; }
.field-list li { padding: 3px 0; padding-left: 16px; position: relative; font-size: 14px; }
.field-list li::before { content: '\2022'; position: absolute; left: 0; color: var(--text-secondary); }
.field-empty { color: #999; font-style: italic; font-family: var(--font-ui); font-size: 13px; }

/* TABS */
.drug-tabs { display: flex; gap: 4px; margin-bottom: 0; border-bottom: 2px solid var(--border); overflow-x: auto; }
.tab-btn { font-family: var(--font-ui); font-size: 13px; font-weight: 600; padding: 10px 18px; border: none; background: none; cursor: pointer; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; white-space: nowrap; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--black); border-bottom-color: var(--black); }
.tab-panels { background: var(--white); border: 1px solid var(--border); border-top: none; border-radius: 0 0 var(--radius) var(--radius); }
.tab-panel { display: none; padding: 20px; }
.tab-panel.active { display: block; }
.panel-section { margin-bottom: 20px; }
.panel-section:last-child { margin-bottom: 0; }
.panel-section h3 { font-family: var(--font-ui); font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--accent); }
.panel-section:first-child h3 { color: var(--red); }
.panel-danger { color: var(--red); }
.panel-danger .field-list li::before { color: var(--red); }
.panel-danger .field-list li { color: var(--red); }

/* INTERACTIONS */
.interactions-list { }
.interaction-item { padding: 10px 0; border-bottom: 1px solid var(--border-light); }
.interaction-item:last-child { border-bottom: none; }
.interaction-drug { font-family: var(--font-ui); font-weight: 600; font-size: 14px; display: block; margin-bottom: 2px; }
.interaction-effect { font-size: 13px; color: var(--text-secondary); display: block; }

/* ASK IDG */
.view-ask { }
.ask-box { display: flex; gap: 8px; max-width: 600px; margin-bottom: 16px; }
.ask-input { flex: 1; font-family: var(--font-ui); font-size: 15px; padding: 12px 16px; border: 2px solid var(--border); border-radius: var(--radius); outline: none; background: var(--white); }
.ask-input:focus { border-color: var(--black); }
.ask-btn { flex-shrink: 0; }
.ask-keywords { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 24px; }
.kw-label { font-family: var(--font-ui); font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.kw-chip { font-family: var(--font-ui); font-size: 12px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 20px; background: var(--white); cursor: pointer; color: var(--text-secondary); transition: all 0.15s; }
.kw-chip:hover { border-color: var(--black); color: var(--text); }
.ask-result { }
.ask-answer { padding: 20px; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); }
.ask-answer.ask-not-found { border-color: var(--red-border); background: var(--red-bg); }
.ask-answer.ask-found { border-left: 4px solid var(--green); }
.ask-answer.ask-empty { border-left: 4px solid var(--border); }
.ask-answer.ask-partial { border-left: 4px solid #c8940e; }
.ask-answer.ask-stage-b { border-left: 4px solid var(--accent); background: var(--white); }
.ask-status-icon { font-size: 20px; display: block; margin-bottom: 8px; }
.ask-not-found-msg { font-family: var(--font-ui); font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 16px; }
.ask-meta { font-family: var(--font-ui); font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.ask-meta code { background: var(--accent-light); padding: 2px 6px; border-radius: 3px; font-size: 12px; }
.ask-value { font-size: 14px; line-height: 1.7; }
.ask-obj { padding: 6px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; font-family: var(--font-ui); }
.ask-obj:last-child { border-bottom: none; }
/* Stage B — related mentions */
.ask-related { margin-top: 4px; }
.ask-related-label { font-family: var(--font-ui); font-size: 12px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.ask-related-list { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ask-related-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border-light); font-family: var(--font-ui); font-size: 14px; color: var(--text); transition: background 0.1s; }
.ask-related-item:last-child { border-bottom: none; }
.ask-related-item:hover { background: var(--accent-light); }
.ask-related-name { font-weight: 600; color: var(--black); flex: 1; }
.ask-related-field { font-size: 12px; color: var(--text-secondary); background: var(--accent-light); border: 1px solid var(--border-light); padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.ask-related-arrow { color: var(--text-secondary); font-size: 13px; flex-shrink: 0; }

/* FAVORITES */
.fav-section { margin-bottom: 28px; }
.fav-section h2 { font-family: var(--font-ui); font-size: 17px; font-weight: 600; margin-bottom: 12px; }
.fav-list { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

/* APPENDIX */
.appendix-block { border-left: 3px solid var(--accent); }

/* DISCLAIMER */
.disclaimer-box { padding: 28px 28px 28px 60px; background: var(--red-bg); border: 1px solid var(--red-border); border-radius: var(--radius); position: relative; }
.disclaimer-icon { position: absolute; left: 20px; top: 28px; font-size: 24px; }
.disclaimer-box p { font-size: 15px; line-height: 1.8; color: var(--text); }

/* MOBILE */
@media (max-width: 380px) {
  .section-title { font-size: 22px; }
  .detail-item { flex-direction: column; gap: 4px; }
  .detail-label { min-width: auto; }
  .section-nav { position: static; }
  .quick-row { flex-direction: column; }
  .quick-label { width: 100%; padding: 8px 16px; border-right: none; border-bottom: 1px solid var(--border-light); }
  .drug-header h1 { font-size: 24px; }
  .drug-item-ind { display: none; }
  .drug-item-name { min-width: auto; }
  .ask-box { flex-direction: column; }
}

/* ── VERSION BADGE ─────────────────────────────────────── */
.version-badge {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  opacity: 0.75;
}
.home-version {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* ── UPDATE TOAST (silent Netflix-style) ───────────────── */
.update-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--black);
  color: var(--white);
  padding: 13px 16px;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
  font-family: var(--font-ui);
  font-size: 13px;
  max-width: 300px;
  animation: toastSlide 0.3s ease;
}
@keyframes toastSlide {
  from { transform: translateY(16px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.update-toast-icon {
  font-size: 17px;
  flex-shrink: 0;
  opacity: 0.85;
}
.update-toast-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.update-toast-body strong {
  font-weight: 600;
  font-size: 13px;
}
.update-toast-sub {
  font-size: 11px;
  opacity: 0.65;
}
.update-toast-close {
  background: none;
  border: none;
  color: var(--white);
  opacity: 0.6;
  font-size: 18px;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
  line-height: 1;
}
.update-toast-close:hover { opacity: 1; }

@media (max-width: 600px) {
  .update-toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }
}

/* ── APP FOOTER ────────────────────────────────────────────── */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--white);
  padding: 14px 24px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
}
.footer-name { font-weight: 700; color: var(--black); letter-spacing: 0.3px; }
.footer-sep  { opacity: 0.4; }
.footer-version {
  font-weight: 600;
  font-size: 11px;
  background: var(--accent-light);
  border: 1px solid var(--border);
  padding: 1px 7px;
  border-radius: 10px;
  color: var(--accent);
  letter-spacing: 0.3px;
}
.footer-copy { opacity: 0.65; }

/* ── APPENDIX CARDS (index page) ───────────────────────────── */
.appendix-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px 20px 20px 18px;
  margin-bottom: 14px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.1s;
  cursor: pointer;
}
.appendix-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.09);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.appendix-card-icon {
  font-size: 24px;
  color: var(--accent);
  flex-shrink: 0;
  width: 32px;
  text-align: center;
}
.appendix-card-body { flex: 1; }
.appendix-card-body h2 {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--black);
}
.appendix-card-body p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}
.appendix-card-arrow {
  font-size: 18px;
  color: var(--accent);
  flex-shrink: 0;
}

/* ── APPENDIX INNER PAGES ──────────────────────────────────── */
.view-appendix { padding: 0 0 40px 0; }
.appendix-top-bar {
  padding: 14px 0 10px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.appendix-disclaimer {
  background: #fffbe6;
  border: 1px solid #f0d060;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 12px;
  color: #7a5c00;
  margin-bottom: 18px;
  line-height: 1.5;
}
.appendix-list {
  margin-top: 10px;
}
.appendix-entry {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: box-shadow 0.12s;
}
.appendix-entry:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
}
.app-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.app-entry-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--black);
}
.app-mono-link {
  font-size: 11.5px;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid var(--accent);
  padding: 2px 9px;
  border-radius: 20px;
  transition: background 0.12s, color 0.12s;
}
.app-mono-link:hover {
  background: var(--accent);
  color: var(--white);
}
.app-class-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 7px;
}
.app-class-tag {
  font-size: 11px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1px 9px;
  font-weight: 500;
  letter-spacing: 0.2px;
}
.app-entry-summary {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}
.appendix-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ── DEBUG VIEW ────────────────────────────────────────────── */
.debug-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 12px; }
.debug-table th { text-align: left; padding: 8px 12px; background: var(--accent-light); font-family: var(--font-ui); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 2px solid var(--border); }
.debug-table td { padding: 10px 12px; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.dbg-key { font-family: var(--font-ui); font-weight: 600; color: var(--text-secondary); white-space: nowrap; width: 160px; }
.dbg-val { font-family: monospace; font-size: 13px; color: var(--black); font-weight: 600; }
.dbg-note { color: var(--text-secondary); font-size: 12px; }
.footer-version { cursor: pointer; text-decoration: none; color: var(--accent); }
.footer-version:hover { text-decoration: underline; }

/* ── ASK IDG IMPROVEMENTS ──────────────────────────────────── */
.ask-examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.ask-ex { font-size: 12px; color: var(--accent); background: var(--accent-light); border: 1px solid var(--border); border-radius: 20px; padding: 2px 10px; cursor: pointer; font-family: var(--font-ui); transition: background 0.12s; }
.ask-ex:hover { background: var(--accent); color: var(--white); }
.ask-sub { font-size: 13px; color: var(--text-secondary); margin: 4px 0 0 0; }
.ask-history-entry { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.ask-history-query { background: var(--accent-light); padding: 8px 14px; font-size: 12px; font-family: var(--font-ui); color: var(--text-secondary); border-bottom: 1px solid var(--border); }
.ask-q-label { font-weight: 700; color: var(--accent); }

/* ── CALCULATOR ────────────────────────────────────────────── */
.view-calc { padding-bottom: 40px; }
.calc-disclaimer { background: #fffbe6; border: 1px solid #f0d060; border-radius: var(--radius); padding: 10px 14px; font-size: 12px; color: #7a5c00; margin-bottom: 20px; }
.calc-form { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.calc-row { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.calc-row:last-child { margin-bottom: 0; }
.calc-label { font-family: var(--font-ui); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-secondary); width: 120px; min-width: 120px; padding-top: 10px; }
.calc-input-wrap { flex: 1; position: relative; }
.calc-weight-wrap { display: flex; align-items: center; gap: 8px; }
.calc-weight-input { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 9px 12px; font-size: 15px; font-family: var(--font-ui); width: 120px; outline: none; transition: border-color 0.15s; }
.calc-weight-input:focus { border-color: var(--accent); }
.calc-weight-unit { font-size: 14px; font-weight: 600; color: var(--text-secondary); }
.calc-btn { margin-top: 4px; }
.calc-result { }
.calc-output { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.calc-error { color: var(--red); border-color: var(--red-border); background: var(--red-bg); }
.calc-unavail { }
.calc-success { border-left: 4px solid var(--accent); }
.calc-drug-name { font-size: 15px; font-weight: 700; margin-bottom: 12px; color: var(--black); }
.calc-result-row { display: flex; align-items: baseline; gap: 8px; margin: 8px 0 12px 0; }
.calc-result-num { font-size: 36px; font-weight: 700; color: var(--black); font-family: var(--font-ui); }
.calc-result-unit { font-size: 18px; color: var(--text-secondary); font-family: var(--font-ui); }
.calc-breakdown { font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; display: flex; flex-direction: column; gap: 3px; }
.calc-range-note { color: #a05000; font-weight: 500; }
.calc-source-label { font-size: 11px; font-family: var(--font-ui); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 4px; }
.calc-source-text { font-size: 13px; color: var(--text-secondary); font-style: italic; background: var(--accent-light); padding: 8px 12px; border-radius: 4px; margin-bottom: 10px; line-height: 1.5; }
.calc-unavail-msg { font-size: 13px; color: #7a5c00; margin-bottom: 10px; }
.calc-disclaimer-inline { font-size: 11.5px; color: #7a5c00; background: #fffbe6; border: 1px solid #f0d060; border-radius: 4px; padding: 6px 10px; margin-top: 8px; }

/* ── ABOUT ─────────────────────────────────────────────────── */
.view-about { max-width: 520px; padding-bottom: 40px; }
.about-logo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.about-logo-box { background: var(--black); color: var(--white); font-family: var(--font-ui); font-size: 20px; font-weight: 800; width: 52px; height: 52px; display: flex; align-items: center; justify-content: center; border-radius: 10px; letter-spacing: -0.5px; flex-shrink: 0; }
.about-title { font-size: 20px; font-weight: 700; color: var(--black); }
.about-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.about-divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
.about-block { margin-bottom: 18px; }
.about-desc { font-size: 14px; line-height: 1.7; color: var(--text); margin-bottom: 10px; }
.about-section-label { font-family: var(--font-ui); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); margin-bottom: 8px; }
.about-person { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.about-person-name { font-size: 15px; font-weight: 700; color: var(--black); margin-bottom: 3px; }
.about-cred { font-size: 12px; font-weight: 600; background: var(--accent-light); color: var(--accent); padding: 1px 7px; border-radius: 4px; margin-left: 6px; }
.about-person-role { font-size: 13px; color: var(--text-secondary); }
.about-person-loc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.about-footer-row { display: flex; align-items: center; gap: 16px; }
.about-version-tag { font-family: var(--font-ui); font-size: 12px; font-weight: 600; background: var(--accent-light); border: 1px solid var(--border); padding: 3px 10px; border-radius: 20px; color: var(--accent); }
.about-link { font-size: 13px; color: var(--accent); text-decoration: none; }
.about-link:hover { text-decoration: underline; }
