/* Everything is prefixed .mw- and the panel is fixed-position, so nothing
   here can reflow Gmail's own layout. Colors are deliberately not Google's:
   the panel should never be mistaken for part of Gmail. */

.mw-panel {
  --mw-ink: #1b2420;
  --mw-paper: #f4f6f4;
  --mw-card: #ffffff;
  --mw-wash: #e9eee9;
  --mw-line: rgba(27, 36, 32, 0.1);
  --mw-muted: #5d6b64;
  --mw-green: #2f4b3f;
  --mw-gold: #b79a3e;
  --mw-gold-hi: #c9ad4d;
  --mw-ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  position: fixed;
  top: 72px;
  right: 16px;
  /* Moving and resizing set the width and height from the panel's measured
     rect, which includes the border. Without this each drag would add 2px. */
  box-sizing: border-box;
  width: min(330px, calc(100vw - 32px));
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2147483000;
  background: var(--mw-paper);
  border: 1px solid var(--mw-line);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(27, 36, 32, 0.06),
    0 12px 32px rgba(27, 36, 32, 0.14), 0 32px 64px -24px rgba(27, 36, 32, 0.24);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--mw-ink);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;

  /* Closed until the toolbar icon opens it. visibility waits for the fade
     to finish so the panel doesn't vanish mid-animation. */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-10px) scale(0.97);
  transform-origin: top right;
  transition: opacity 0.16s ease, transform 0.22s var(--mw-ease),
    visibility 0s linear 0.22s;
}

.mw-panel.mw-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
  transition: opacity 0.18s ease, transform 0.28s var(--mw-ease), visibility 0s;
}

.mw-panel:focus {
  outline: none;
}

/* The header doubles as the drag handle; the grip in the bottom-right corner
   resizes. */
.mw-bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 10px 16px;
  background: var(--mw-card);
  border-bottom: 1px solid var(--mw-line);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.mw-panel.mw-dragging {
  user-select: none;
  box-shadow: 0 2px 4px rgba(27, 36, 32, 0.08),
    0 18px 44px rgba(27, 36, 32, 0.2), 0 40px 80px -24px rgba(27, 36, 32, 0.3);
}

.mw-panel.mw-dragging .mw-bar {
  cursor: grabbing;
}

.mw-grip {
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
  touch-action: none;
  opacity: 0.45;
  background: linear-gradient(
    135deg,
    transparent 45%,
    var(--mw-muted) 45%,
    var(--mw-muted) 53%,
    transparent 53%,
    transparent 66%,
    var(--mw-muted) 66%,
    var(--mw-muted) 74%,
    transparent 74%
  );
  transition: opacity 0.15s;
}

.mw-grip:hover,
.mw-panel.mw-dragging .mw-grip {
  opacity: 0.9;
}

.mw-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.mw-brand svg {
  width: 22px;
  height: 22px;
  flex: none;
}

.mw-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--mw-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.mw-close:hover {
  background: var(--mw-wash);
  color: var(--mw-ink);
}

.mw-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px 12px 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(27, 36, 32, 0.2) transparent;
}

.mw-headline {
  margin: 0 4px 12px;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.mw-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 8px 12px;
  background: var(--mw-wash);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--mw-green);
  animation: mw-in 0.25s var(--mw-ease);
}

.mw-status::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mw-gold);
}

.mw-sweep {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  color: var(--mw-ink);
  background: var(--mw-gold);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(27, 36, 32, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s var(--mw-ease);
}

.mw-sweep:hover:not(:disabled) {
  background: var(--mw-gold-hi);
  box-shadow: 0 4px 12px rgba(183, 154, 62, 0.35);
  transform: translateY(-1px);
}

.mw-sweep:active:not(:disabled) {
  transform: scale(0.99);
}

.mw-sweep:disabled {
  opacity: 0.55;
  cursor: progress;
}

.mw-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mw-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  padding: 10px 12px;
  background: var(--mw-card);
  border: 1px solid var(--mw-line);
  border-radius: 12px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.mw-row:hover {
  border-color: rgba(27, 36, 32, 0.18);
  box-shadow: 0 2px 8px rgba(27, 36, 32, 0.06);
}

.mw-row.mw-on {
  border-color: var(--mw-gold);
  box-shadow: 0 0 0 3px rgba(183, 154, 62, 0.18);
}

.mw-name {
  grid-column: 1;
  font-weight: 600;
}

.mw-detail {
  grid-column: 1;
  color: var(--mw-muted);
  font-size: 12px;
}

.mw-stat {
  grid-column: 1;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--mw-green);
}

/* Progress: a thin bar in each busy row, a bigger one under the sweep
   button. Idle bars fold shut rather than vanish, so rows don't jump. */
.mw-prog {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "track track" "label eta";
  gap: 5px 8px;
  max-height: 40px;
  margin-top: 8px;
  overflow: hidden;
  opacity: 1;
  font-size: 11px;
  color: var(--mw-muted);
  transition: max-height 0.3s var(--mw-ease), margin 0.3s var(--mw-ease),
    padding 0.3s var(--mw-ease), opacity 0.2s ease;
}

.mw-prog.mw-idle {
  max-height: 0;
  margin-top: 0;
  opacity: 0;
}

.mw-track {
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--mw-wash);
}

.mw-fill {
  position: relative;
  width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: var(--mw-gold);
  transition: width 0.3s linear, background 0.3s;
}

/* A soft highlight running across the fill says "still working" even while
   a slow step keeps the bar itself nearly still. */
.mw-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.55),
    transparent
  );
  transform: translateX(-100%);
  animation: mw-shimmer 1.4s ease-in-out infinite;
}

.mw-prog.mw-done .mw-fill {
  background: var(--mw-green);
}

.mw-prog.mw-done .mw-fill::after {
  animation: none;
  opacity: 0;
}

.mw-prog .mw-track {
  grid-area: track;
}

.mw-prog-label {
  grid-area: label;
  min-width: 0;
}

.mw-prog-count {
  grid-area: count;
  display: none;
}

.mw-prog-eta {
  grid-area: eta;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* The big bar reads top to bottom: what's being checked and how far along,
   then the bar, then the time left. */
.mw-prog.mw-big {
  grid-template-areas: "label count" "track track" "eta eta";
  gap: 8px;
  max-height: 110px;
  margin: 0 0 12px;
  padding: 12px;
  font-size: 12px;
  background: var(--mw-card);
  border: 1px solid var(--mw-line);
  border-radius: 12px;
}

.mw-prog.mw-big.mw-idle {
  max-height: 0;
  margin: 0;
  padding-block: 0;
  border-width: 0;
}

.mw-big .mw-track {
  height: 8px;
}

.mw-big .mw-prog-count {
  display: block;
  color: var(--mw-ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.mw-big .mw-prog-label {
  color: var(--mw-ink);
  font-weight: 500;
}

.mw-acts {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mw-go,
.mw-count {
  font: inherit;
  white-space: nowrap;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s,
    transform 0.15s var(--mw-ease);
}

.mw-go {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--mw-ink);
  background: var(--mw-paper);
  border: 1px solid var(--mw-line);
}

.mw-go:hover:not(:disabled) {
  background: var(--mw-ink);
  border-color: var(--mw-ink);
  color: var(--mw-paper);
}

.mw-count {
  padding: 4px 10px;
  font-size: 11px;
  color: var(--mw-green);
  background: transparent;
  border: 1px dashed rgba(93, 107, 100, 0.5);
}

.mw-count:hover:not(:disabled) {
  border-style: solid;
  background: var(--mw-wash);
}

.mw-go:active:not(:disabled),
.mw-count:active:not(:disabled) {
  transform: scale(0.96);
}

.mw-acts button:disabled {
  opacity: 0.45;
  cursor: default;
}

.mw-how,
.mw-note {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--mw-muted);
}

.mw-how {
  padding: 12px;
  background: var(--mw-card);
  border: 1px solid var(--mw-line);
  border-radius: 12px;
  color: var(--mw-ink);
}

.mw-note {
  padding: 0 4px 4px;
}

.mw-panel button:focus-visible {
  outline: 2px solid var(--mw-gold);
  outline-offset: 2px;
}

@keyframes mw-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

@keyframes mw-shimmer {
  to {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mw-panel,
  .mw-panel * {
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    animation: none !important;
  }
}
