:root {
  --warning: #f59e0b;
  --danger: #ef4444;
  --header-height: 60px;
}

html {
  overflow-y: scroll;
}

a {
  text-decoration: none;
  color: var(--primary);
}

a:hover {
  text-decoration: underline;
}

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
  display: none;
}

.brand {
  padding: 20px;
  font-weight: bold;
  color: var(--primary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-menu {
  padding: 20px 10px;
  flex: 1;
}

.nav-group-label {
  font-size: 12px;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 12px 5px;
  margin-top: 10px;
}

.nav-item {
  display: block;
  margin: 2px 0;
  color: var(--text-main);
  transition: all 0.2s;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: var(--bg-body);
  text-decoration: none;
}

.nav-item.active {
  font-weight: 500;
}

.user-panel {
  padding: 15px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.02);
}

.main-content {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.page-title {
  margin: 0;
  font-size: 24px;
  color: var(--text-main);
}

.breadcrumb {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.card {
  border: 1px solid var(--border);
  border-top: 3px solid transparent;
  margin-bottom: 20px;
}

.card.main-card {
  border-top-color: var(--primary);
}

.card.algo-feature {
  background: var(--bg-body);
  border: none;
  padding: 16px;
  margin-top: 12px;
}

.card.algo-feature h4 {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--primary);
}

.card.algo-feature p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.crypto-workspace {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.crypto-workspace.layout-stack {
  grid-template-columns: 100% !important;
}

.input-group {
  margin-bottom: 16px;
}

.input-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 14px;
}

.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-body);
  color: var(--text-main);
  font-family: 'Fira Code', Consolas, monospace;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--bg-card);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-outline {
  border-color: var(--border);
}

.toolbar {
  display: inline-flex;
  gap: 4px;
  background: var(--bg-body);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
  margin-left: auto;
}

.tool-btn {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  line-height: 1;
}

.tool-btn:hover {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 20px;
  border-radius: 6px;
  background: var(--bg-card);
  border-left: 4px solid var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 250px;
  animation: slideIn 0.3s ease;
  color: var(--text-main);
  font-size: 14px;
}

.toast.success {
  border-left-color: var(--success);
}

.toast.error {
  border-left-color: var(--danger);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
  .sidebar.mobile-open {
    display: flex;
    position: fixed;
    z-index: 100;
    width: 80%;
    box-shadow: 10px 0 20px rgba(0, 0, 0, 0.2);
  }
  .crypto-workspace {
    grid-template-columns: 1fr;
  }
}

.encoding-tabs {
  display: inline-flex;
  background: var(--bg-body);
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--border);
  vertical-align: middle;
  margin-left: 10px;
}

.enc-tab {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  border: none;
  background: transparent;
  transition: all 0.2s;
  font-family: inherit;
}

.enc-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.enc-tab.active {
  background: var(--bg-card);
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
  text-decoration: none;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn-text {
  background: transparent;
  padding: 4px 8px;
  color: var(--primary);
  font-size: 12px;
  height: auto;
  border: none;
}

.btn-text:hover {
  text-decoration: underline;
  background: rgba(16, 185, 129, 0.1);
}

.btn-outline {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-main);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(16, 185, 129, 0.05);
}
