:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #193d34;
  background: #f4f6f3;
  --green: #087b5b;
  --deep: #07523f;
  --muted: #70817a;
  --border: #dbe5df;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; }
body { min-width: 320px; overflow: hidden; }
button, a { font: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  grid-template-rows: 96px minmax(0, 1fr);
  width: 100%;
  height: 100dvh;
  min-height: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px;
  border-right: 1px solid var(--border);
  background: #fff;
}
.brand img { flex: none; border-radius: 10px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 17px; }
.brand span { margin-top: 4px; color: var(--muted); font-size: 12px; }

.tabs {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 18px 12px;
  border-right: 1px solid var(--border);
  background: #fff;
}
.tab {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #48645a;
  text-align: left;
  cursor: pointer;
}
.tab:hover { background: #f0f6f2; }
.tab.is-active { background: #e5f3ec; color: var(--deep); font-weight: 700; }
.tab-icon { display: grid; width: 24px; height: 24px; place-items: center; font-size: 21px; }
.tab:focus-visible, a:focus-visible { outline: 3px solid #efa83b; outline-offset: 2px; }

.workspace { grid-column: 2; grid-row: 1 / 3; min-width: 0; min-height: 0; background: #fff; }
.panel { width: 100%; height: 100%; min-width: 0; min-height: 0; }
.panel[hidden] { display: none; }
.module-frame, .pdf-frame { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.book-panel { display: flex; flex-direction: column; }
.book-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
}
.book-toolbar a { color: var(--green); font-weight: 650; }
.pdf-frame { flex: 1; min-height: 0; }

.nav-footer {
  margin-top: auto;
  padding: 16px 8px 6px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  border-top: 1px dashed var(--border);
}
.nav-footer a {
  color: var(--muted);
  text-decoration: none;
}
.nav-footer a:hover {
  color: var(--green);
  text-decoration: underline;
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: 64px 58px minmax(0, 1fr); }
  .brand { grid-column: 1; grid-row: 1; gap: 9px; padding: 9px 13px; border-right: 0; border-bottom: 1px solid var(--border); }
  .brand img { width: 38px; height: 38px; }
  .brand strong { font-size: 15px; }
  .brand span { display: none; }
  .tabs { grid-column: 1; grid-row: 2; flex-direction: row; gap: 4px; padding: 5px 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); }
  .tab { flex: 1 0 auto; justify-content: center; gap: 7px; min-height: 46px; padding: 8px 10px; font-size: 13px; white-space: nowrap; }
  .tab-icon { width: 19px; height: 20px; font-size: 18px; }
  .workspace { grid-column: 1; grid-row: 3; }
  .book-toolbar { min-height: 42px; padding: 6px 10px; font-size: 12px; }
}

@media (max-width: 380px) {
  .tab { gap: 5px; padding-inline: 7px; font-size: 12px; }
}
