.guide-shell {
  --guide-bg: #eef4f0;
  --guide-surface: rgba(255, 255, 255, 0.94);
  --guide-surface-soft: #f5faf7;
  --guide-border: #d4e2da;
  --guide-border-strong: #9ab7aa;
  --guide-ink: #163126;
  --guide-muted: #5c7167;
  --guide-accent: #0f766e;
  --guide-accent-deep: #0b5d58;
  --guide-accent-soft: rgba(15, 118, 110, 0.1);
  --guide-shadow: 0 20px 40px rgba(18, 40, 29, 0.08);
  padding: 1rem 1rem 2rem;
  min-height: calc(100vh - 90px);
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.14), transparent 34%),
    linear-gradient(180deg, #f7fbf8 0%, var(--guide-bg) 100%);
}

.guide-shell .header-text,
.guide-shell h5 {
  color: var(--guide-ink) !important;
}

.guide-shell .btn {
  white-space: normal !important;
  word-break: break-word;
}

.guide-hero {
  position: relative;
  overflow: visible;
  display: flex;
  gap: 1.25rem;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--guide-border);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(235, 245, 240, 0.98));
  box-shadow: var(--guide-shadow);
}

.guide-hero-content {
  min-width: 0;
}

.guide-hero::after {
  content: "";
  position: absolute;
  inset: auto -60px -70px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.18), transparent 68%);
  pointer-events: none;
  z-index: 0;
}

.guide-kicker,
.guide-sidebar-kicker {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--guide-accent);
}

.guide-page-title {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--guide-ink);
}

.guide-page-subtitle {
  max-width: 56rem;
  margin: 0.75rem 0 0;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--guide-muted);
}

.guide-hero-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 0 0 auto;
  width: min(320px, 34vw);
  flex-direction: column;
  gap: 0.75rem;
  align-items: stretch;
}

.guide-notification-box {
  position: relative;
}

.guide-notification-toggle {
  display: flex;
  width: 100%;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  border-radius: 16px;
  font-weight: 700;
}

.guide-tools-toggle {
  min-height: 46px;
  border-radius: 16px;
  font-weight: 700;
}

.guide-notification-list {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  z-index: 1300;
  width: min(420px, calc(100vw - 2rem));
  max-height: min(480px, 70vh);
  overflow-y: auto;
  padding: 0.7rem;
  border: 1px solid var(--guide-border);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 36px rgba(18, 40, 29, 0.18);
}

.guide-notification-item {
  display: block;
  width: 100%;
  padding: 0.8rem 0.85rem;
  border: 1px solid transparent;
  border-radius: 14px;
  background: #f8fbf9;
  color: var(--guide-ink);
  text-align: left;
}

.guide-notification-item + .guide-notification-item {
  margin-top: 0.55rem;
}

.guide-notification-item.is-unread {
  border-color: rgba(15, 118, 110, 0.22);
  background: var(--guide-accent-soft);
}

.guide-notification-title,
.guide-notification-message,
.guide-notification-meta {
  display: block;
}

.guide-notification-title {
  font-weight: 700;
}

.guide-notification-message {
  margin-top: 0.25rem;
  color: var(--guide-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.guide-notification-meta {
  margin-top: 0.45rem;
  color: var(--guide-muted);
  font-size: 0.78rem;
}

.guide-notification-dot {
  margin-left: 0.35rem;
  color: var(--guide-accent);
  font-weight: 700;
}

.guide-notification-empty {
  padding: 0.85rem;
  color: var(--guide-muted);
  text-align: center;
}

.guide-sync-btn {
  position: static;
  z-index: 1;
  width: 100%;
  min-height: 48px;
  border: none;
  border-radius: 16px;
  padding: 0.75rem 1.1rem;
  background: linear-gradient(135deg, #167c74, #0b5d58);
  box-shadow: 0 16px 30px rgba(11, 93, 88, 0.24);
}

.guide-tools-panel {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--guide-border);
  border-radius: 24px;
  background: var(--guide-surface);
  box-shadow: var(--guide-shadow);
}

.guide-tools-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.guide-tools-title {
  margin: 0;
  color: var(--guide-ink);
  font-size: 1.4rem;
  font-weight: 700;
}

.guide-tools-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.guide-tool-tab {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--guide-border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--guide-ink);
  font-weight: 700;
}

.guide-tool-tab.active {
  border-color: var(--guide-accent-deep);
  background: var(--guide-accent-deep);
  color: #ffffff;
}

.guide-tool-pane {
  display: none;
}

.guide-tool-pane.active {
  display: block;
}

.guide-tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.85rem;
}

.guide-tool-grid label,
.guide-tool-check,
.guide-tool-checks label {
  color: var(--guide-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.guide-tool-grid .form-control,
.guide-tool-grid .form-select {
  margin-top: 0.35rem;
  min-height: 44px;
  border-radius: 12px;
}

.guide-tool-check,
.guide-tool-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 0.85rem;
}

.guide-tool-calc {
  margin-top: 0.9rem;
  min-height: 44px;
  border-radius: 14px;
}

.guide-tool-result {
  margin-top: 0.9rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 16px;
  background: var(--guide-accent-soft);
  color: var(--guide-ink);
  font-weight: 600;
  line-height: 1.55;
}

.guide-tool-result strong {
  display: block;
  font-size: 1.05rem;
}

.guide-sync-status {
  position: static;
  z-index: 1;
  width: 100% !important;
  padding: 0.85rem 1rem;
  border: 1px solid var(--guide-border);
  border-radius: 18px;
  background: var(--guide-surface) !important;
  box-shadow: 0 14px 26px rgba(18, 40, 29, 0.12);
  backdrop-filter: blur(12px);
}

#status-message {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--guide-ink);
  font-weight: 600;
}

#status-progress {
  border-radius: 999px;
  background: linear-gradient(90deg, #0f766e, #2aa198) !important;
}

.guide-toolbar {
  margin-top: 1rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid var(--guide-border);
  border-radius: 24px;
  background: var(--guide-surface);
  box-shadow: var(--guide-shadow);
}

.guide-toolbar .form-group {
  margin-bottom: 0;
}

.guide-toolbar-btn,
.guide-toolbar .bootstrap-select > .dropdown-toggle {
  min-height: 52px;
  border-radius: 16px;
  font-weight: 600;
}

.guide-toolbar .bootstrap-select > .dropdown-toggle {
  border: 1px solid var(--guide-border);
  background: #ffffff;
  box-shadow: none;
}

.guide-layout {
  margin-top: 1.25rem;
  row-gap: 1.25rem;
}

.guide-sidebar-card,
.guide-editor-panel,
.guide-viewer-panel {
  background: var(--guide-surface) !important;
  border: 1px solid var(--guide-border);
  border-radius: 28px;
  box-shadow: var(--guide-shadow);
}

.guide-sidebar-card {
  padding: 1.2rem !important;
}

.guide-sidebar-head {
  padding: 0 0.25rem 0.8rem;
}

.guide-sidebar-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--guide-ink);
}

.guide-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0;
}

#navToggle {
  display: none;
}

#sidebar .btn-group.dropend {
  display: block;
  width: 100%;
}

#sidebar .nav-item.btn-secondary,
#sidebar .btn-group.dropend > .dropdown-toggle,
#sidebar .side-item.dropdown-item,
#sidebar .dropdown-submenu > .dropdown-toggle {
  width: 100%;
  padding: 0.82rem 1rem;
  border: 1px solid var(--guide-border);
  border-radius: 16px;
  background: #f9fcfb;
  color: var(--guide-ink);
  font-weight: 600;
  text-align: left;
  box-shadow: none;
}

#sidebar .nav-item.btn-secondary a {
  color: inherit !important;
}

#sidebar .side-item.dropdown-item.nav-create {
  background: linear-gradient(135deg, #15756e, #0b5d58);
  color: #ffffff;
  border-color: transparent;
}

#sidebar .btn-group.dropend > .dropdown-toggle[aria-expanded="true"],
#sidebar .dropdown-submenu > .dropdown-toggle[aria-expanded="true"] {
  background: var(--guide-accent-deep);
  color: #ffffff;
  border-color: var(--guide-accent-deep);
}

#sidebar .btn-group.dropend > .dropdown-menu {
  position: static;
  inset: auto !important;
  transform: none !important;
  width: 100%;
  min-width: 0;
  margin-top: 0.5rem;
  padding: 0.7rem;
  border: 1px solid var(--guide-border);
  border-radius: 20px;
  background: var(--guide-surface-soft);
  box-shadow: none;
}

#sidebar .dropdown-submenu {
  position: relative;
}

#sidebar .dropdown-submenu > .side-drop-menu {
  top: 0;
  left: 100%;
  margin-top: -1px;
}

#sidebar .dropdown-submenu .dropdown-menu {
  position: static;
  min-width: 0;
  margin: 0.45rem 0 0 0.85rem;
  padding: 0.6rem;
  border: 0;
  border-left: 3px solid var(--guide-accent);
  border-radius: 0 18px 18px 0;
  background: #ffffff;
  box-shadow: none;
}

#sidebar .side-drop-menu.show,
#sidebar .side-drop-menu.is-open {
  display: block !important;
}

#sidebar .side-drop-menu button,
#sidebar .side-drop-menu a {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.4;
}

#sidebar .pdf-show {
  margin: 0.45rem 0;
}

#sidebar .pdf-show a,
#sidebar .dropdown-menu a {
  background: #ffffff;
}

.dropdown-submenu > .dropdown-toggle::after {
  display: inline-block;
  margin-left: 0.5em;
  vertical-align: middle;
  content: "";
  border-top: 0.3em solid;
  border-right: 0.3em solid transparent;
  border-left: 0.3em solid transparent;
  transform: rotate(-90deg);
  transition: transform 0.2s ease-in-out;
}

.dropdown-submenu > .dropdown-toggle[aria-expanded="true"]::after {
  transform: rotate(0deg);
}

.guide-editor-panel,
.guide-viewer-panel {
  padding: 1.35rem !important;
}

.guide-form-card {
  padding: 1.5rem;
  border: 1px solid var(--guide-border);
  border-radius: 24px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbf9 100%);
}

.guide-form-card + .guide-form-card {
  margin-top: 1rem;
}

.guide-form-card .row {
  row-gap: 1rem;
}

.guide-form-card .header-text {
  margin-bottom: 1rem;
  font-size: clamp(1.45rem, 2vw, 2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.guide-form-card label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--guide-muted);
}

.guide-context-badge {
  display: none;
  margin: 0 0 1rem !important;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 16px;
  background: var(--guide-accent-soft);
  color: var(--guide-ink) !important;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.5;
}

.guide-form-card .form-control,
.guide-form-card .form-select {
  min-height: 50px;
  border: 1px solid var(--guide-border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: none;
}

.guide-form-card .form-control:focus,
.guide-form-card .form-select:focus {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 0.25rem rgba(15, 118, 110, 0.12);
}

.guide-form-card input[type="file"] {
  width: 100%;
  padding: 0.85rem;
  border: 1px dashed var(--guide-border-strong);
  border-radius: 16px;
  background: #ffffff;
}

button[type="submit"],
#pdf-download,
#pdf_update,
#nav_delete {
  min-height: 48px;
  border-radius: 16px;
  font-weight: 600;
}

button[type="submit"] {
  margin-top: 10px;
  min-width: 160px;
  border: none;
  background: linear-gradient(135deg, #15756e, #0b5d58);
  box-shadow: 0 14px 24px rgba(11, 93, 88, 0.18);
}

.guide-viewer-panel {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 78vh;
}

#main-header {
  margin: 0;
  font-size: clamp(1.6rem, 2.7vw, 2.45rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--guide-ink);
}

#initialGreeting {
  max-width: 68ch;
  margin: 0;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--guide-muted);
}

.guide-pdf-viewer {
  flex: 1;
  min-height: 70vh;
  padding: 1rem;
  border: 1px solid var(--guide-border);
  border-radius: 24px;
  background: linear-gradient(180deg, #f9fcfb 0%, #f3f8f5 100%);
}

.guide-pdf-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  padding: 0.25rem 0 0.9rem !important;
}

#pdf-iframe {
  width: 100%;
  min-height: 560px;
  height: calc(100vh - 260px);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px #dce5df;
}

@media (min-width: 992px) {
  #sidebar.sidebar {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
  }
}

@media (min-width: 992px) and (max-width: 1440px) {
  .guide-hero-actions {
    width: min(300px, 30vw);
  }

  #sidebar .btn.btn-lg,
  #sidebar .dropdown-item,
  #sidebar .dropdown-toggle {
    font-size: 0.95rem;
  }
}

@media (max-width: 1024px) {
  .guide-shell {
    padding: 0.75rem 0.75rem 1.5rem;
  }

  .guide-hero,
  .guide-toolbar,
  .guide-sidebar-card,
  .guide-editor-panel,
  .guide-viewer-panel {
    border-radius: 22px;
  }

  .sidebar.show {
    left: 0;
  }

  .final-side {
    display: none;
  }

  #navToggle {
    display: block;
  }

  .sidebar {
    position: absolute;
    left: -1000px;
    width: 100%;
    padding: 1rem !important;
    background: var(--guide-surface);
    transition: left 0.35s ease;
    z-index: 999;
  }

  .guide-editor-panel,
  .guide-viewer-panel {
    padding: 1rem !important;
  }

  .guide-form-card {
    padding: 1.1rem;
  }

  #sidebar .dropdown-submenu .dropdown-menu,
  #sidebar .btn-group.dropend > .dropdown-menu {
    border: none;
    box-shadow: none;
  }

  #sidebar .dropdown-submenu .dropdown-menu {
    margin-left: 0.4rem;
    padding-left: 0.6rem;
  }

  #pdf-iframe {
    min-height: 420px;
    height: 58vh;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .guide-hero {
    align-items: flex-start;
  }

  .guide-hero-actions {
    width: min(280px, 36vw);
  }

  .guide-sync-btn {
    min-height: 46px;
    padding: 0.7rem 0.95rem;
  }
}

@media (max-width: 767px) {
  .guide-hero {
    display: block;
  }

  .guide-hero-actions {
    width: auto;
  }

  .guide-sync-btn {
    position: fixed;
    right: 0.75rem;
    bottom: 0.75rem;
    z-index: 1100;
    width: auto;
    max-width: min(260px, calc(100vw - 1.5rem));
  }

  .guide-sync-status {
    position: fixed;
    right: 0.75rem;
    bottom: 4.4rem;
    z-index: 1090;
    width: min(340px, calc(100vw - 1.5rem)) !important;
  }

  .guide-notification-list {
    position: fixed;
    top: 4.25rem;
    left: 0.75rem;
    right: 0.75rem;
    z-index: 1300;
    width: auto;
    max-height: calc(100vh - 5.5rem);
  }

  .guide-tools-panel {
    padding: 0.85rem;
    border-radius: 20px;
  }

  .guide-tools-head {
    align-items: center;
  }

  .guide-tool-grid {
    grid-template-columns: 1fr;
  }
}
