* {
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #111113;
  color: #E0E0E0;
  font-family: "JetBrains Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.is-hidden {
  display: none !important;
}

/* App Shell */
.app-shell {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background-color: #111113;
}

/* Left Sidebar (3-Zone -webkit-box Sticky Footer Layout) */
.sidebar {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 264px;
  height: 100%;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  background-color: #1A1A1C;
  border-right: 2px solid #111113;
  z-index: 30;
  -webkit-user-select: none;
  user-select: none;
  visibility: visible;
  opacity: 1;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  -webkit-transition: -webkit-transform 0.24s ease-out, opacity 0.24s ease-out, visibility 0.24s;
  transition: transform 0.24s ease-out, opacity 0.24s ease-out, visibility 0.24s;
}

.app-shell.sidebar-collapsed .sidebar {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  -webkit-transform: translate3d(-264px, 0, 0);
  transform: translate3d(-264px, 0, 0);
}

.sidebar-top {
  background-color: #161618;
  border-bottom: 1px solid rgba(224, 224, 224, 0.12);
}

.sidebar-scroll {
  -webkit-box-flex: 1;
  height: 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.sidebar-footer {
  padding: 10px 14px 12px 14px;
  background-color: #141416;
  border-top: 1px solid rgba(255, 62, 0, 0.32);
}

.sidebar-header {
  display: -webkit-box;
  -webkit-box-orient: horizontal;
  -webkit-box-align: center;
  -webkit-box-pack: justify;
  padding: 12px 14px 10px 14px;
  border-bottom: 1px solid rgba(224, 224, 224, 0.08);
}

.sidebar-brand {
  -webkit-box-flex: 1;
  min-width: 0;
  margin-right: 8px;
}

.brand-title {
  font-family: "Syne", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-weight: 800;
  line-height: 22px;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  color: #FF3E00;
  white-space: nowrap;
}

.sync-footer-meta {
  margin-bottom: 8px;
}

.sync-user-badge {
  display: inline-block;
  max-width: 100%;
  padding: 2px 7px;
  margin-bottom: 4px;
  border: 1px solid rgba(255, 62, 0, 0.35);
  border-radius: 3px;
  background-color: rgba(255, 62, 0, 0.1);
  font-size: 10px;
  font-weight: 700;
  color: #FFE4DB;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-status-text {
  font-size: 11px;
  color: #FF3E00;
  font-weight: 500;
}

.sync-status-text.is-offline {
  color: #FBBF24;
}

.sync-status-text.is-synced {
  color: #34D399;
}

.sync-status-text.is-auth-paused {
  color: #FBBF24;
  text-decoration: underline;
  cursor: pointer;
}

.drive-status-pill {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 6px 8px;
  border: 1px solid rgba(224, 224, 224, 0.16);
  border-radius: 4px;
  background-color: #1D1D20;
  color: #E0E0E0;
  font-family: "JetBrains Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 10px;
  font-weight: 700;
  line-height: 14px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  -webkit-transition: background-color 0.15s ease-out, border-color 0.15s ease-out, -webkit-transform 0.12s ease-out;
  transition: background-color 0.15s ease-out, border-color 0.15s ease-out, transform 0.12s ease-out;
}

.drive-status-pill:hover {
  background-color: #26262A;
}

.drive-status-pill:active {
  -webkit-transform: translate3d(0, 1px, 0) scale(0.98);
  transform: translate3d(0, 1px, 0) scale(0.98);
}

.drive-status-dot {
  display: inline-block;
  vertical-align: middle;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  margin-top: -1px;
  border-radius: 50%;
  background-color: #f59e0b;
}

.drive-status-label {
  display: inline-block;
  vertical-align: middle;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drive-status-pill.is-connected {
  border-color: rgba(34, 197, 94, 0.45);
  color: #DCFCE7;
}

.drive-status-pill.is-connected .drive-status-dot {
  background-color: #22c55e;
}

.drive-status-pill.is-local {
  border-color: rgba(245, 158, 11, 0.45);
  color: #FEF3C7;
}

.drive-status-pill.is-local .drive-status-dot {
  background-color: #f59e0b;
}

.drive-status-pill.is-error {
  border-color: rgba(239, 68, 68, 0.55);
  color: #FEE2E2;
}

.drive-status-pill.is-error .drive-status-dot {
  background-color: #ef4444;
}

.drive-status-pill.is-offline {
  border-color: rgba(156, 163, 175, 0.4);
  color: #D1D5DB;
}

.drive-status-pill.is-offline .drive-status-dot {
  background-color: #9ca3af;
}

.sync-footer-actions {
  display: -webkit-box;
  -webkit-box-orient: horizontal;
  width: 100%;
  margin-top: 7px;
}

.btn.sync-footer-half {
  -webkit-box-flex: 1;
  display: block;
  width: 0;
  min-width: 0;
  text-align: center;
  padding: 4px 4px;
  margin-right: 0;
  font-size: 10px;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-footer-actions .btn.sync-footer-half:first-child {
  margin-right: 6px;
}

.sidebar-search-wrap {
  position: relative;
  padding: 10px 14px;
  background-color: #161618;
}

.sidebar-search-input {
  display: block;
  width: 100%;
  height: 32px;
  padding: 4px 26px 4px 9px;
  border: 1px solid rgba(224, 224, 224, 0.16);
  border-radius: 3px;
  background-color: #111113;
  color: #E0E0E0;
  font-family: inherit;
  font-size: 11px;
  -webkit-appearance: none;
}

.sidebar-search-input:focus {
  outline: 1px solid #FF3E00;
  border-color: #FF3E00;
}

.sidebar-search-clear {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 24px;
  height: 28px;
  border: none;
  background: transparent;
  color: rgba(224, 224, 224, 0.65);
  font-size: 14px;
  line-height: 26px;
  cursor: pointer;
}

/* Full-screen Offline-Friendly Login & Pattern Overlay */
.auth-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 200;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 48px 16px 24px 16px;
  text-align: center;
  background-color: #111113;
  background-image:
    -webkit-linear-gradient(left, rgba(224, 224, 224, 0.08) 1px, transparent 1px),
    -webkit-linear-gradient(top, rgba(224, 224, 224, 0.08) 1px, transparent 1px);
  background-image:
    linear-gradient(90deg, rgba(224, 224, 224, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(224, 224, 224, 0.08) 1px, transparent 1px);
  -webkit-background-size: 40px 40px;
  background-size: 40px 40px;
  visibility: visible;
  opacity: 1;
  -webkit-transition: opacity 0.22s ease-out, visibility 0.22s;
  transition: opacity 0.22s ease-out, visibility 0.22s;
}

.auth-overlay.is-closed {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.auth-card {
  display: inline-block;
  width: 360px;
  max-width: 100%;
  padding: 24px;
  background-color: #1A1A1C;
  border: 1px solid #FF3E00;
  text-align: left;
  -webkit-box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  -webkit-transform: translate3d(0, 0, 0) scale(1);
  transform: translate3d(0, 0, 0) scale(1);
  opacity: 1;
  -webkit-transition: -webkit-transform 0.22s ease-out, opacity 0.22s ease-out;
  transition: transform 0.22s ease-out, opacity 0.22s ease-out;
}

.auth-overlay.is-closed .auth-card {
  -webkit-transform: translate3d(0, 12px, 0) scale(0.97);
  transform: translate3d(0, 12px, 0) scale(0.97);
  opacity: 0;
}

.auth-brand {
  font-family: "Syne", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  color: #FF3E00;
  margin-bottom: 10px;
}

.auth-title {
  font-size: 16px;
  font-weight: 700;
  color: #E0E0E0;
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 12px;
  color: rgba(224, 224, 224, 0.65);
  margin-bottom: 14px;
}

.auth-error {
  padding: 8px 10px;
  margin-bottom: 12px;
  border: 1px solid #EF4444;
  background-color: rgba(220, 38, 38, 0.16);
  color: #FCA5A5;
  font-size: 12px;
}

.auth-tabs {
  display: -webkit-box;
  -webkit-box-orient: horizontal;
  width: 100%;
  margin-bottom: 14px;
  border: 1px solid rgba(224, 224, 224, 0.16);
  background-color: #111113;
}

.auth-tab-btn {
  -webkit-box-flex: 1;
  display: block;
  width: 0;
  min-width: 0;
  padding: 8px 6px;
  border: none;
  border-right: 1px solid rgba(224, 224, 224, 0.12);
  background-color: transparent;
  color: rgba(224, 224, 224, 0.65);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
  cursor: pointer;
  -webkit-appearance: none;
}

.auth-tab-btn:last-child {
  border-right: none;
}

.auth-tab-btn.is-active {
  background-color: #FF3E00;
  color: #111113;
}

.auth-form {
  display: block;
}

.auth-secondary-btn {
  margin-top: 8px;
}

.saved-user-switcher {
  margin-top: 10px;
  margin-bottom: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(224, 224, 224, 0.1);
  text-align: left;
}

.auth-pattern-panel .saved-user-switcher {
  margin-top: 4px;
  margin-bottom: 8px;
  padding: 6px 8px;
  border: 1px solid rgba(224, 224, 224, 0.12);
  background-color: #141416;
  text-align: center;
}

.user-switcher-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(224, 224, 224, 0.55);
  margin-bottom: 6px;
}

.user-switch-pills {
  display: block;
  font-size: 0;
}

.user-switch-chip {
  display: inline-block;
  vertical-align: middle;
  margin: 0 5px 5px 0;
  padding: 4px 8px;
  border: 1px solid rgba(224, 224, 224, 0.22);
  border-radius: 3px;
  background-color: #1D1D20;
  color: #E0E0E0;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  -webkit-appearance: none;
}

.user-switch-chip:hover {
  border-color: #FF3E00;
}

.user-switch-chip.is-active {
  border-color: #FF3E00;
  background-color: rgba(255, 62, 0, 0.18);
  color: #FFE4DB;
}

.auth-pattern-panel {
  text-align: center;
}

.auth-pattern-user {
  font-size: 11px;
  font-weight: 700;
  color: #FF3E00;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.pattern-canvas-wrap {
  display: block;
  text-align: center;
  margin: 8px auto 12px auto;
}

.pattern-canvas {
  display: inline-block;
  width: 240px;
  height: 240px;
  background-color: #111113;
  border: 1px solid rgba(224, 224, 224, 0.2);
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.auth-pattern-hint {
  font-size: 11px;
  color: rgba(224, 224, 224, 0.65);
  margin-bottom: 12px;
}

.sidebar-section {
  padding: 12px 14px 8px 14px;
  border-bottom: 1px solid rgba(224, 224, 224, 0.08);
}

.sidebar-section-pages {
  border-bottom: none;
}

.section-header {
  display: -webkit-box;
  -webkit-box-orient: horizontal;
  -webkit-box-align: center;
  -webkit-box-pack: justify;
  padding-bottom: 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(224, 224, 224, 0.1);
}

.section-title {
  -webkit-box-flex: 1;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(224, 224, 224, 0.6);
}

.nav-list {
  list-style: none;
}

.nav-item {
  display: -webkit-box;
  -webkit-box-orient: horizontal;
  -webkit-box-align: center;
  margin-bottom: 6px;
  padding: 2px 3px 2px 6px;
  border: 1px solid rgba(224, 224, 224, 0.08);
  border-left: 3px solid transparent;
  border-radius: 4px;
  background-color: #212124;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  -webkit-transition: background-color 0.15s ease, border-color 0.15s ease, -webkit-transform 0.12s ease;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.nav-item:hover {
  border-color: rgba(224, 224, 224, 0.18);
  background-color: #27272B;
}

.nav-item.is-active {
  border-color: rgba(255, 62, 0, 0.45);
  border-left: 3px solid #FF3E00;
  background-color: rgba(255, 62, 0, 0.1);
}

.nav-thumb {
  width: 18px;
  height: 22px;
  margin-right: 7px;
  border: 1px solid rgba(224, 224, 224, 0.25);
  border-radius: 2px;
  background-color: #FFFFFF;
}

.nav-thumb-ruled {
  background-image: -webkit-linear-gradient(top, #FFFFFF 3px, #CBD5E1 4px, #FFFFFF 5px);
  -webkit-background-size: 18px 6px;
}

.nav-thumb-grid {
  background-image:
    -webkit-linear-gradient(left, #D1D5DB 1px, transparent 1px),
    -webkit-linear-gradient(top, #D1D5DB 1px, transparent 1px);
  -webkit-background-size: 6px 6px;
}

.nav-thumb-dots {
  background-color: #F8FAFC;
}

.nav-thumb-cornell {
  border-left: 4px solid #E11D48;
}

.nav-thumb-dark {
  background-color: #15181C;
  border-color: rgba(255, 62, 0, 0.45);
}

.nav-thumb-pdf {
  background-color: #FEE2E2;
  border-color: #EF4444;
}

.nav-item-btn {
  -webkit-box-flex: 1;
  display: block;
  width: auto;
  min-width: 0;
  min-height: 38px;
  padding: 5px 6px 5px 2px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: rgba(240, 240, 240, 0.85);
  font-family: inherit;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item-btn:hover {
  color: #FFFFFF;
}

.nav-item.is-active .nav-item-btn {
  font-weight: 700;
  color: #FF551F;
}

.nav-item-sub {
  display: block;
  font-size: 10px;
  font-weight: normal;
  color: rgba(224, 224, 224, 0.55);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-badge {
  display: inline-block;
  padding: 1px 4px;
  margin-right: 4px;
  border-radius: 2px;
  background-color: rgba(255, 62, 0, 0.16);
  border: 1px solid rgba(255, 62, 0, 0.35);
  color: #FF9F80;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-item-actions {
  padding-right: 2px;
  white-space: nowrap;
}

.nav-icon-btn {
  display: inline-block;
  min-width: 26px;
  min-height: 28px;
  padding: 4px 5px;
  margin-left: 2px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: rgba(224, 224, 224, 0.56);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  -webkit-transition: background-color 0.12s ease, color 0.12s ease;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.nav-icon-btn:hover {
  background-color: rgba(224, 224, 224, 0.12);
  color: #FFFFFF;
}

.nav-del-btn {
  color: rgba(248, 113, 113, 0.85);
  font-weight: 700;
}

.nav-del-btn:hover {
  background-color: rgba(220, 38, 38, 0.24);
  border-color: rgba(248, 113, 113, 0.45);
  color: #FCA5A5;
}

.nav-star-btn {
  color: rgba(224, 224, 224, 0.45);
  font-size: 13px;
}

.nav-star-btn.is-starred {
  color: #FBBF24;
}

.nav-empty-note {
  padding: 8px 6px;
  font-size: 11px;
  color: rgba(224, 224, 224, 0.48);
}

/* Main Workspace */
.workspace {
  position: absolute;
  top: 0;
  left: 264px;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background-color: #111113;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  -webkit-transition: left 0.24s ease-out;
  transition: left 0.24s ease-out;
}

.app-shell.sidebar-collapsed .workspace {
  left: 0;
}

/* Compact Single-Row Icon Header Toolbar */
.topbar {
  position: relative;
  z-index: 25;
  height: 50px;
  padding: 5px 10px;
  background-color: #1A1A1C;
  border-bottom: 2px solid #111113;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  -webkit-user-select: none;
  user-select: none;
}

.toolbar-group {
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
  padding-right: 8px;
  border-right: 1px solid rgba(224, 224, 224, 0.1);
}

.toolbar-group:last-child {
  margin-right: 0;
  padding-right: 0;
  border-right: none;
}

.page-title-input {
  display: inline-block;
  vertical-align: middle;
  width: 122px;
  height: 36px;
  padding: 0 8px;
  margin-left: 4px;
  border: 1px solid rgba(224, 224, 224, 0.14);
  background-color: #111113;
  color: #E0E0E0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}

.page-title-input:focus {
  outline: 1px solid #FF3E00;
  border-color: #FF3E00;
}

/* Compact Icon Buttons */
.icon-btn {
  display: inline-block;
  vertical-align: middle;
  min-width: 40px;
  height: 38px;
  padding: 3px 6px;
  margin-right: 3px;
  border: 1px solid rgba(224, 224, 224, 0.14);
  background-color: #111113;
  color: #E0E0E0;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  -webkit-appearance: none;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  -webkit-transition: background-color 0.14s ease, border-color 0.14s ease, -webkit-transform 0.12s ease;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}

.icon-btn:last-child {
  margin-right: 0;
}

.icon-btn:hover {
  border-color: #E0E0E0;
  background-color: rgba(224, 224, 224, 0.08);
}

.icon-btn:active {
  -webkit-transform: translate3d(0, 1px, 0) scale(0.96);
  transform: translate3d(0, 1px, 0) scale(0.96);
}

.icon-btn:focus {
  outline: 1px solid #FF3E00;
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.icon-btn.is-active {
  background-color: #FF3E00;
  border-color: #FF3E00;
  color: #111113;
  font-weight: 700;
}

.btn-tool-eraser.is-active {
  background-color: #FBBF24;
  border-color: #FFFFFF;
  color: #111113;
  -webkit-box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.38);
  box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.38);
}

.icon-glyph {
  display: block;
  height: 17px;
  line-height: 17px;
  font-size: 15px;
  text-align: center;
}

.icon-label {
  display: block;
  height: 12px;
  line-height: 12px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 1px;
}

.size-dot-preview {
  display: inline-block;
  vertical-align: middle;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #E0E0E0;
}

.color-btn-swatch {
  display: inline-block;
  vertical-align: middle;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background-color: #1C1917;
}

.toolbar-zoom {
  white-space: nowrap;
}

.zoom-step-btn,
.zoom-reset-btn {
  display: inline-block;
  vertical-align: middle;
  height: 38px;
  padding: 0 8px;
  margin-right: 2px;
  border: 1px solid rgba(224, 224, 224, 0.14);
  background-color: #111113;
  color: #E0E0E0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  -webkit-appearance: none;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  -webkit-transition: background-color 0.14s ease, border-color 0.14s ease, -webkit-transform 0.12s ease;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}

.zoom-step-btn:active,
.zoom-reset-btn:active {
  -webkit-transform: translate3d(0, 1px, 0) scale(0.96);
  transform: translate3d(0, 1px, 0) scale(0.96);
}

.zoom-reset-btn {
  min-width: 46px;
  font-size: 11px;
}

.zoom-step-btn:last-child,
.zoom-reset-btn:last-child {
  margin-right: 0;
}

.zoom-step-btn:hover,
.zoom-reset-btn:hover {
  border-color: #E0E0E0;
}

.zoom-reset-btn.is-active {
  border-color: #FF3E00;
  color: #FF3E00;
}

/* Popovers & Floating Strips */
.toolbar-popover {
  position: fixed;
  top: 54px;
  left: 16px;
  z-index: 60;
  width: 262px;
  max-width: 94%;
  padding: 12px;
  background-color: #1A1A1C;
  border: 1px solid #FF3E00;
  -webkit-box-shadow: 0 10px 26px rgba(0, 0, 0, 0.65);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.65);
  -webkit-user-select: none;
  user-select: none;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  -webkit-transition: opacity 0.16s ease-out, -webkit-transform 0.16s ease-out, visibility 0.16s;
  transition: opacity 0.16s ease-out, transform 0.16s ease-out, visibility 0.16s;
}

.toolbar-popover.is-closed {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  -webkit-transform: translate3d(0, -8px, 0);
  transform: translate3d(0, -8px, 0);
}

.popover-page {
  width: 292px;
}

.popover-section {
  margin-bottom: 12px;
}

.popover-section:last-child {
  margin-bottom: 0;
}

.popover-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(224, 224, 224, 0.55);
  margin-bottom: 6px;
}

.popover-btn-row {
  display: block;
}

.popover-btn-row .btn {
  margin-bottom: 4px;
}

.swatch-grid {
  display: block;
  width: 228px;
  font-size: 0;
}

.swatch-btn {
  display: inline-block;
  vertical-align: middle;
  width: 33px;
  height: 26px;
  margin: 0 6px 6px 0;
  border: 1px solid rgba(224, 224, 224, 0.25);
  cursor: pointer;
  -webkit-appearance: none;
}

.swatch-btn:nth-child(6n) {
  margin-right: 0;
}

.swatch-btn.is-active {
  outline: 2px solid #FF3E00;
  border-color: #FFFFFF;
}

.color-spectrum-canvas {
  display: block;
  width: 228px;
  height: 120px;
  border: 1px solid rgba(224, 224, 224, 0.22);
  cursor: crosshair;
  touch-action: none;
}

.color-preview-row {
  margin-top: 8px;
}

.color-hex-preview {
  display: inline-block;
  vertical-align: middle;
  width: 22px;
  height: 18px;
  margin-right: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background-color: #1C1917;
}

.color-hex-label {
  display: inline-block;
  vertical-align: middle;
  font-size: 11px;
  font-weight: 700;
  color: #E0E0E0;
}

.recent-colors-row {
  min-height: 24px;
  font-size: 0;
}

.recent-swatch-btn {
  display: inline-block;
  vertical-align: middle;
  width: 22px;
  height: 22px;
  margin: 0 5px 4px 0;
  border: 1px solid rgba(224, 224, 224, 0.3);
  cursor: pointer;
  -webkit-appearance: none;
}

.recent-swatch-btn.is-active {
  outline: 2px solid #FF3E00;
}

.page-meta-text {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  color: rgba(224, 224, 224, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Floating Strip for Text Formatting & Selection Actions */
.floating-strip {
  position: absolute;
  top: 56px;
  left: 12px;
  right: 12px;
  z-index: 24;
  padding: 6px 10px;
  background-color: rgba(26, 26, 28, 0.96);
  border: 1px solid #FF3E00;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  -webkit-box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
  -webkit-user-select: none;
  user-select: none;
}

.strip-group {
  display: inline-block;
  vertical-align: middle;
  margin-right: 10px;
  padding-right: 10px;
  border-right: 1px solid rgba(224, 224, 224, 0.14);
}

.strip-group:last-child {
  margin-right: 0;
  padding-right: 0;
  border-right: none;
}

.strip-label {
  display: inline-block;
  vertical-align: middle;
  margin-right: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(224, 224, 224, 0.55);
}

.tb-color-dot {
  display: inline-block;
  vertical-align: middle;
  width: 11px;
  height: 11px;
  margin-right: 4px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background-color: #1C1917;
}

/* Standard Buttons */
.btn {
  display: inline-block;
  vertical-align: middle;
  min-height: 34px;
  padding: 6px 11px;
  margin-right: 4px;
  border: 1px solid rgba(224, 224, 224, 0.16);
  background-color: transparent;
  color: #E0E0E0;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 20px;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  -webkit-transform: translate3d(0, 0, 0);
  transform: translate3d(0, 0, 0);
  -webkit-transition: background-color 0.14s ease, border-color 0.14s ease, -webkit-transform 0.12s ease;
  transition: background-color 0.14s ease, border-color 0.14s ease, transform 0.12s ease;
}

.btn:last-child {
  margin-right: 0;
}

.btn:hover {
  border-color: #E0E0E0;
  background-color: rgba(224, 224, 224, 0.05);
}

.btn:active {
  -webkit-transform: translate3d(0, 1px, 0) scale(0.98);
  transform: translate3d(0, 1px, 0) scale(0.98);
}

.btn:focus {
  outline: 1px solid #FF3E00;
}

.btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.btn-compact {
  min-height: 28px;
  padding: 3px 9px;
  font-size: 11px;
  line-height: 18px;
}

.btn-block {
  display: block;
  width: 100%;
  margin-right: 0;
  text-align: center;
}

.btn-primary {
  background-color: #FF3E00;
  border-color: #FF3E00;
  color: #111113;
  font-weight: 700;
}

.btn-primary:hover {
  background-color: #FF551F;
  border-color: #FF551F;
}

.btn-secondary {
  background-color: #111113;
  border-color: rgba(224, 224, 224, 0.18);
  color: #E0E0E0;
}

.btn-subtle {
  background-color: transparent;
  border-color: rgba(224, 224, 224, 0.16);
  color: #E0E0E0;
}

.btn-ghost {
  background-color: transparent;
  border-color: rgba(224, 224, 224, 0.12);
  color: rgba(224, 224, 224, 0.78);
}

.btn-danger {
  background-color: #DC2626;
  border-color: #DC2626;
  color: #FFFFFF;
  font-weight: 700;
}

.btn-toggle.is-active {
  background-color: #FF3E00;
  border-color: #FF3E00;
  color: #111113;
  font-weight: 700;
}

.file-btn-wrap {
  position: relative;
  overflow: hidden;
}

.file-btn-wrap.is-busy {
  opacity: 0.55;
}

.file-btn-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  font-size: 40px;
  opacity: 0;
  cursor: pointer;
}

/* Infinite Canvas Viewport */
.canvas-viewport {
  position: absolute;
  top: 50px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background-color: #FFFFFF;
  touch-action: none;
}

.page-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #FFFFFF;
  -webkit-user-select: none;
  user-select: none;
}

.page-stage.is-dark-paper {
  background-color: #15181C;
}

.page-stage canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

#bg-canvas {
  z-index: 1;
}

/* Inserted Images Layer */
.image-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

#ink-canvas {
  z-index: 3;
  pointer-events: none;
}

#overlay-canvas {
  z-index: 4;
  cursor: crosshair;
  touch-action: none;
}

.page-stage.mode-lasso #overlay-canvas {
  cursor: default;
}

.page-stage.mode-text #overlay-canvas {
  cursor: text;
}

.page-stage.mode-eraser #overlay-canvas {
  cursor: none;
}

.page-stage.mode-pan #overlay-canvas {
  cursor: move;
}

.image-box {
  position: absolute;
  min-width: 48px;
  min-height: 48px;
  border: 1px solid transparent;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-transform-origin: 0 0;
  transform-origin: 0 0;
}

.page-stage.mode-lasso .image-layer {
  z-index: 6;
}

.page-stage.mode-lasso .image-box {
  pointer-events: auto;
  border: 1px dashed rgba(255, 62, 0, 0.45);
  cursor: move;
}

.page-stage.mode-lasso .image-box.is-selected {
  border: 2px solid #FF3E00;
  -webkit-box-shadow: 0 0 0 2px rgba(255, 62, 0, 0.22);
  box-shadow: 0 0 0 2px rgba(255, 62, 0, 0.22);
}

.img-content {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-user-drag: none;
}

.img-corner-handle {
  display: none;
  position: absolute;
  width: 14px;
  height: 14px;
  background-color: #1A1A1C;
  border: 2px solid #FF3E00;
  z-index: 4;
}

.page-stage.mode-lasso .image-box.is-selected .img-corner-handle {
  display: block;
}

.img-handle-nw {
  top: -7px;
  left: -7px;
  cursor: nwse-resize;
}

.img-handle-ne {
  top: -7px;
  right: -7px;
  cursor: nesw-resize;
}

.img-handle-sw {
  bottom: -7px;
  left: -7px;
  cursor: nesw-resize;
}

.img-handle-se {
  bottom: -7px;
  right: -7px;
  cursor: nwse-resize;
}

/* Movable Text Boxes Layer */
.text-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  overflow: hidden;
}

.text-box {
  position: absolute;
  min-width: 120px;
  min-height: 64px;
  border: 1px solid #FF3E00;
  background-color: rgba(255, 255, 255, 0.94);
  pointer-events: auto;
  -webkit-transform-origin: 0 0;
  transform-origin: 0 0;
}

.text-box.is-focused {
  border: 1px solid #FF3E00;
  background-color: #FFFFFF;
  -webkit-box-shadow: 0 0 0 2px rgba(255, 62, 0, 0.25);
  box-shadow: 0 0 0 2px rgba(255, 62, 0, 0.25);
}

.page-stage.is-dark-paper .text-box {
  background-color: rgba(21, 24, 28, 0.92);
}

.page-stage.mode-pen .text-box,
.page-stage.mode-highlighter .text-box,
.page-stage.mode-eraser .text-box,
.page-stage.mode-lasso .text-box,
.page-stage.mode-pan .text-box {
  pointer-events: none;
  border-color: transparent;
  background-color: transparent;
}

.page-stage.mode-pen .tb-header,
.page-stage.mode-highlighter .tb-header,
.page-stage.mode-eraser .tb-header,
.page-stage.mode-lasso .tb-header,
.page-stage.mode-pan .tb-header,
.page-stage.mode-pen .tb-resize,
.page-stage.mode-highlighter .tb-resize,
.page-stage.mode-eraser .tb-resize,
.page-stage.mode-lasso .tb-resize,
.page-stage.mode-pan .tb-resize {
  display: none;
}

.tb-header {
  position: relative;
  height: 22px;
  padding: 2px 6px;
  background-color: #FF3E00;
  cursor: move;
  font-size: 10px;
  font-weight: 700;
  color: #111113;
  line-height: 18px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  -webkit-user-select: none;
  user-select: none;
}

.tb-delete {
  position: absolute;
  top: 0;
  right: 2px;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: #111113;
  font-size: 14px;
  font-weight: bold;
  line-height: 20px;
  text-align: center;
  cursor: pointer;
}

.tb-delete:hover {
  color: #FFFFFF;
}

.tb-textarea {
  display: block;
  width: 100%;
  height: 100%;
  padding: 6px 8px;
  border: none;
  background: transparent;
  resize: none;
  font-family: "JetBrains Mono", Menlo, Monaco, Consolas, "Courier New", monospace;
  font-size: 16px;
  line-height: 1.4;
  color: #1C1917;
  overflow-y: auto;
  overflow-x: hidden;
  word-wrap: break-word;
  -webkit-overflow-scrolling: touch;
}

.tb-textarea:focus {
  outline: none;
}

.tb-resize {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 20px;
  height: 20px;
  cursor: nwse-resize;
  background-color: #1A1A1C;
  border-top: 1px solid #FF3E00;
  border-left: 1px solid #FF3E00;
}

.tb-resize:after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 9px 9px;
  border-color: transparent transparent #FF3E00 transparent;
}

.sidebar-backdrop {
  display: none;
}

/* Inline Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background-color: rgba(0, 0, 0, 0.8);
  text-align: center;
  padding: 48px 16px 24px 16px;
  visibility: visible;
  opacity: 1;
  -webkit-transition: opacity 0.2s ease-out, visibility 0.2s;
  transition: opacity 0.2s ease-out, visibility 0.2s;
}

.modal-overlay.is-closed {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.modal-card {
  display: inline-block;
  width: 380px;
  max-width: 92%;
  padding: 22px;
  background-color: #1A1A1C;
  border: 1px solid #FF3E00;
  text-align: left;
  -webkit-transform: translate3d(0, 0, 0) scale(1);
  transform: translate3d(0, 0, 0) scale(1);
  opacity: 1;
  -webkit-transition: -webkit-transform 0.2s ease-out, opacity 0.2s ease-out;
  transition: transform 0.2s ease-out, opacity 0.2s ease-out;
}

.modal-overlay.is-closed .modal-card {
  -webkit-transform: translate3d(0, 12px, 0) scale(0.97);
  transform: translate3d(0, 12px, 0) scale(0.97);
  opacity: 0;
}

.modal-title {
  font-family: "Syne", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  color: #FF3E00;
  margin-bottom: 10px;
}

.modal-message {
  font-size: 12px;
  line-height: 1.5;
  color: #E0E0E0;
  margin-bottom: 14px;
  white-space: pre-line;
}

.modal-input-wrap {
  margin-bottom: 16px;
}

.modal-input-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-weight: 700;
  color: rgba(224, 224, 224, 0.6);
  margin-bottom: 6px;
}

.modal-input {
  display: block;
  width: 100%;
  height: 36px;
  padding: 6px 10px;
  border: 1px solid rgba(224, 224, 224, 0.2);
  font-family: inherit;
  font-size: 13px;
  color: #E0E0E0;
  background-color: #111113;
}

.modal-input:focus {
  outline: 1px solid #FF3E00;
  border-color: #FF3E00;
}

.modal-actions {
  text-align: right;
}

.modal-preview-wrap {
  margin-bottom: 16px;
  text-align: center;
}

.modal-preview-img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  margin: 0 auto 12px auto;
  border: 1px solid rgba(224, 224, 224, 0.25);
  background-color: #FFFFFF;
}

.image-url-btn {
  margin-top: 8px;
}

.image-modal-note {
  margin-top: 8px;
  font-size: 11px;
  color: #FBBF24;
}

/* Custom Scrollbar for WebKit */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-thumb {
  background-color: rgba(224, 224, 224, 0.16);
}

/* Portrait iPad & Narrow Viewports */
@media screen and (max-width: 960px) {
  .workspace {
    left: 0;
  }

  .sidebar {
    z-index: 45;
    -webkit-box-shadow: 4px 0 18px rgba(0, 0, 0, 0.55);
    box-shadow: 4px 0 18px rgba(0, 0, 0, 0.55);
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background-color: rgba(0, 0, 0, 0.65);
    visibility: visible;
    opacity: 1;
    -webkit-transition: opacity 0.24s ease-out, visibility 0.24s;
    transition: opacity 0.24s ease-out, visibility 0.24s;
  }

  .app-shell.sidebar-collapsed .sidebar-backdrop {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .page-title-input {
    width: 92px;
  }
}

@media screen and (max-width: 640px) {
  .topbar {
    padding: 5px 6px;
  }

  .page-title-input {
    width: 74px;
    padding: 0 5px;
    font-size: 11px;
  }

  .icon-btn {
    min-width: 34px;
    padding: 3px 5px;
  }
}
