html, body {
  margin: 0;
  padding: 0;
}

body.nb-body {
  background: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.6;
}

@media (max-width: 640px) {
  html {
    font-size: 17px;
  }
}

/* ---------------------------------- */
/* Layout + Surfaces */
/* ---------------------------------- */

.nb-header {
  background: var(--color-white);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-soft);
}

.nb-brand {
  color: var(--color-primary-text);
}

.nb-card {
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
  box-shadow: var(--shadow-soft);
}

.nb-card-muted {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 1rem;
}

.nb-card .nb-table tbody tr:first-child td,
.nb-card .nb-table tbody tr:first-child th {
  border-top: 0;
}

/* ---------------------------------- */
/* Buttons */
/* ---------------------------------- */

.nb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.9rem;
  border-radius: 0.75rem;
  border: 1px solid var(--color-border);
  background: var(--color-white);
  color: var(--color-text-secondary);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.nb-btn:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.nb-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.nb-btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-on-primary);
}

.nb-btn-primary:hover {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

.nb-btn-success {
  background: var(--color-success);
  border-color: var(--color-success);
  color: var(--color-text-on-primary);
}

.nb-btn-success:hover {
  background: var(--color-success-strong);
  border-color: var(--color-success-strong);
}

.nb-btn-subtle {
  background: var(--color-surface);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

.nb-btn-subtle:hover {
  background: var(--color-primary-light);
}

/* ---------------------------------- */
/* Links */
/* ---------------------------------- */

.nb-link {
  color: var(--color-primary);
  text-decoration: none;
}

.nb-link:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* ---------------------------------- */
/* Inputs */
/* ---------------------------------- */

.nb-input,
.nb-textarea,
.nb-select {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  background: var(--color-white);
  color: var(--color-text-primary);
  padding: 0.65rem 0.85rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.nb-input:focus,
.nb-textarea:focus,
.nb-select:focus {
  border-color: var(--color-border-focus);
  box-shadow: 0 0 0 3px rgba(217, 123, 79, 0.15);
}

.nb-input-error {
  border-color: var(--color-border-error);
}

.handled-methods .nb-btn {
  min-height: 42px;
  border-radius: 14px;
}

.handled-methods .nb-btn.active,
.handled-methods .nb-btn[aria-pressed="true"] {
  background: rgba(218, 126, 74, 0.14);
  border-color: var(--color-brand-primary);
  color: var(--color-brand-primary-strong);
}

.handled-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  border: none;
  background: var(--color-surface);
  margin-bottom: 8px;
}

.handled-action-group .nb-btn {
  min-height: 42px;
  border-radius: 14px;
}


/* ---------------------------------- */
/* Text helpers */
/* ---------------------------------- */

.nb-help {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

.nb-error-text {
  color: var(--color-error);
  font-size: 0.875rem;
}

.nb-date-pill {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(125, 88, 64, 0.12);
  font-weight: 500;
  font-size: 12px;
}

/* ---------------------------------- */
/* Tables */
/* ---------------------------------- */

.nb-table {
  width: 100%;
  border-collapse: collapse;
}

.nb-table thead {
  background: var(--color-surface);
  color: var(--color-text-secondary);
}

.nb-table th,
.nb-table td {
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--color-border);
  text-align: left;
}

.nb-table-row:hover {
  background: #fffaf8;
}

/* Archived row support */
.hidden-archived tr.is-archived {
  display: none;
}

tr.is-archived {
  opacity: 0.55;
}

tr.is-archived td {
  color: var(--color-text-muted);
}

tr.is-archived td:last-child {
  display: none;
}

.arch-label {
  display: inline-flex;
  margin-left: 8px;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
}


/* ---------------------------------- */
/* Shortcuts */
/* ---------------------------------- */

.nb-shortcuts-btn {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nb-shortcuts-btn:hover {
  color: var(--color-text-secondary);
}

.nb-shortcuts-q {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  background: var(--color-surface-soft);
  font-size: 0.625rem;
  font-weight: 600;
}





/* ---------------------------------- */
/* Badges */
/* ---------------------------------- */

.nb-badge {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
  gap: 0.35rem;
  padding: 4px 8px;
  text-align: center;
  border-radius: 0.65rem;
  border: 1px solid var(--color-border);
  font-size: 0.875rem;
}

.nb-badge-warning {
  background: var(--color-warning-light);
  border-color: var(--color-border-subtle);
  color: var(--color-warning);
}

.nb-badge-error {
  background: var(--color-error-light);
  border-color: var(--color-border-error);
  color: var(--color-error);
}

.nb-badge-success {
  background: var(--color-success-light);
  border-color: rgba(45, 138, 78, 0.25);
  color: var(--color-success);
}

/* ---------------------------------- */
/* Toast System */
/* ---------------------------------- */

.nb-toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nb-toast {
  min-width: 320px;
  max-width: calc(100vw - 32px);
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  padding: 12px;
  animation: toast-in 0.2s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 640px) {
  .nb-toast-stack {
    left: 12px;
    right: 12px;
    top: 12px;
  }
  .nb-toast {
    width: 100%;
  }
}

.nb-toast .title {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nb-toast .msg {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin-top: 4px;
}

.nb-toast .actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.nb-toast .bar {
  height: 3px;
  border-radius: 999px;
  background: var(--color-primary-light);
  margin-top: 10px;
  overflow: hidden;
}

.nb-toast .bar > div {
  height: 100%;
  width: 100%;
  transform-origin: left;
  background: var(--color-primary);
  animation: nb-shrink linear forwards;
}

@keyframes nb-shrink {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

.custom-snooze-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px;
  border: none;
  background: var(--color-surface-soft);
}

.custom-snooze-presets .nb-btn,
.custom-snooze-mini-presets .nb-btn {
  min-height: 42px;
  border-radius: 14px;
}

/* ---------------------------------- */
/* Segmented Control */
/* ---------------------------------- */

.nb-seg {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--color-white);
}

.nb-seg button {
  padding: 0.4rem 0.7rem;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.nb-seg button.active {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
}

.nb-seg button:not(.active):hover {
  background: var(--color-primary-light);
}

/* ---------------------------------- */
/* Keyboard key */
/* ---------------------------------- */

.nb-kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  padding: 2px 8px;
  border-radius: 8px;
  font-size: 12px;
}

/* ---------------------------------- */
/* Modal */
/* ---------------------------------- */

.nb-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(26, 18, 16, 0.4);
  z-index: 70;
}

.nb-modal-wrap {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

/* ---------------------------------- */
/* Row states */
/* ---------------------------------- */

.nb-row-selected {
  outline: 2px solid rgba(217, 123, 79, 0.45);
  outline-offset: -2px;
  background: var(--color-primary-light);
}

.nb-row-busy {
  opacity: 0.65;
}

.nb-row-busy button {
  pointer-events: none;
}

.nb-busy-dot {
  display: none;
  margin-left: 8px;
  align-items: center;
  gap: 4px;
  color: var(--color-text-muted);
  font-size: 12px;
}

.nb-row-busy .nb-busy-dot {
  display: inline-flex;
}

.nb-busy-dot span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--color-text-muted);
  animation: nb-pulse 1s infinite;
}

.nb-busy-dot span:nth-child(2) { animation-delay: .15s; }
.nb-busy-dot span:nth-child(3) { animation-delay: .3s; }

@keyframes nb-pulse {
  0% { opacity: .25; }
  50% { opacity: 1; }
  100% { opacity: .25; }
}

/* ---------------------------------- */
/* Handled method pills */
/* ---------------------------------- */

.nb-pill {
  border: 1px solid var(--color-border);
  background: var(--color-white);
  color: var(--color-text-secondary);
  border-radius: 999px;
  padding: 0.4rem 0.65rem;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.nb-pill:hover {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
}

.nb-pill.active {
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  border-color: var(--color-primary);
}


/* ------------------------------------ */
/* Queue cards */
/* ------------------------------------ */


/* Mobile queue cards */
.queue-card-item {
  padding: 18px;
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.queue-card-item .min-w-0 {
  padding-right: 6px;
}

.queue-card-item .space-y-2 {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(125, 88, 64, 0.10);
}

.queue-card-item .grid {
  gap: 10px;
}

.queue-card-item .nb-btn {
  min-height: 44px;
  border-radius: 14px;
  font-weight: 500;
}

.queue-card-item .nb-btn-success {
  font-weight: 600;
}

.queue-card-item .text-right {
  margin-top: 2px;
}