/* TaskTimer 3.10.9 — restore completed tasks without duplicates */
.tt-app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.tt-app-title {
  flex: 0 0 auto;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.tt-app-brand {
  display: flex;
  flex: 0 1 245px;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.tt-app-description {
  max-width: 245px;
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: #f8fafc;
  color: #64748b;
  font-size: 10px;
  line-height: 1.35;
}

.dark .tt-app-description {
  border-color: #334155;
  background: #172033;
  color: #a8b3c7;
}

.tt-header-nav,
.tt-header-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.tt-header-tools {
  position: relative;
}

.tt-header-nav button,
.tt-header-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid #d9dee8;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font-size: 14px;
  line-height: 1.15;
  text-decoration: none;
  white-space: nowrap;
}

.tt-header-nav button:hover,
.tt-header-nav a:hover { background: #f8fafc; }

.tt-header-nav .tt-taskpool-link {
  border-color: #4f46e5;
  background: #4f46e5;
  color: #fff;
  font-weight: 700;
}

.tt-header-nav .tt-taskpool-link:hover { background: #4338ca; }

.tt-taskpool-short { display: none; }

.tt-header-tool {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: inherit;
}

.tt-header-tool:hover { background: #f3f4f6; }
.dark .tt-header-tool:hover { background: #1f2937; }

.tt-header-search-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(320px, calc(100vw - 32px));
  max-width: calc(100vw - 24px);
}

.tt-modal__header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
}

.dark .tt-modal__header {
  background: #111827;
}

.dark .tt-header-nav button,
.dark .tt-header-nav a:not(.tt-taskpool-link) {
  border-color: #374151;
  background: #111827;
  color: #f3f4f6;
}

.tt-month-summary {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid #dbe4ff;
  border-radius: 14px;
  background: linear-gradient(135deg, #f7f9ff 0%, #f1f5ff 100%);
}

.tt-month-summary__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #475569;
  font-size: 12px;
}

.tt-month-summary__head strong {
  color: #27326f;
  font-size: 13px;
  text-transform: capitalize;
}

.tt-month-summary__grid {
  display: grid;
  grid-template-columns: minmax(130px, .8fr) minmax(180px, 1fr) minmax(230px, 1.4fr);
  gap: 10px;
}

.tt-month-summary__metric,
.tt-month-summary__leaders {
  padding: 10px 11px;
  border: 1px solid rgba(99, 102, 241, .14);
  border-radius: 11px;
  background: rgba(255, 255, 255, .78);
}

.tt-month-summary__metric > span,
.tt-month-summary__leaders > span {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: 11px;
}

.tt-month-summary__metric > strong {
  display: block;
  color: #111827;
  font-size: 16px;
  line-height: 1.25;
}

.tt-month-summary__metric > strong.is-positive { color: #15803d; }
.tt-month-summary__metric > strong.is-negative { color: #b45309; }

.tt-month-summary__leaders > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 3px;
  font-size: 11px;
}

.tt-month-summary__leaders b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tt-month-summary__leaders div span { color: #64748b; white-space: nowrap; }
.tt-month-summary__leaders em { color: #64748b; font-size: 11px; font-style: normal; }

.dark .tt-month-summary {
  border-color: #334155;
  background: linear-gradient(135deg, #111827 0%, #172033 100%);
}

.dark .tt-month-summary__head,
.dark .tt-month-summary__metric > span,
.dark .tt-month-summary__leaders > span,
.dark .tt-month-summary__leaders div span,
.dark .tt-month-summary__leaders em { color: #94a3b8; }
.dark .tt-month-summary__head strong { color: #c7d2fe; }
.dark .tt-month-summary__metric,
.dark .tt-month-summary__leaders { border-color: #334155; background: rgba(15, 23, 42, .72); }
.dark .tt-month-summary__metric > strong { color: #f8fafc; }

@media (max-width: 760px) {
  .tt-month-summary__grid { grid-template-columns: 1fr 1fr; }
  .tt-month-summary__leaders { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  html.tw-course-banner-visible .tt-modal-layer {
    top: var(--tw-course-banner-height, 58px);
  }

  .tt-modal-positioner {
    padding: 8px;
  }

  .tt-modal-layer .tt-modal {
    max-height: calc(100dvh - var(--tw-course-banner-height, 0px) - 16px) !important;
  }

  .tt-app-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 6px;
  }

  .tt-app-title {
    min-width: 0;
    font-size: 21px;
    text-align: left;
  }

  .tt-app-brand {
    flex-basis: auto;
    max-width: 235px;
  }

  .tt-app-description {
    max-width: 235px;
    padding: 4px 7px;
    font-size: 9px;
  }

  .tt-header-tools { gap: 0; }
  .tt-header-tool { width: 34px; height: 34px; padding: 7px; }

  .tt-header-search-panel {
    right: 0;
    left: auto;
    width: min(320px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
  }

  .tt-header-nav {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    width: 100%;
  }

  .tt-header-nav button,
  .tt-header-nav a {
    min-width: 0;
    min-height: 36px;
    padding: 7px 4px;
    border-radius: 9px;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .tt-taskpool-full { display: none; }
  .tt-taskpool-short { display: inline; }
  .tt-month-summary { padding: 11px; }
  .tt-month-summary__grid { grid-template-columns: 1fr; }
  .tt-month-summary__leaders { grid-column: auto; }
}

@media (max-width: 360px) {
  .tt-app-title { font-size: 19px; }
  .tt-header-tool { width: 31px; height: 31px; padding: 6px; }
  .tt-header-nav { gap: 4px; }
  .tt-header-nav button,
  .tt-header-nav a { font-size: 11px; }
}

/* v3.10.22: modal layout below course banner, centered in available viewport */
.tt-modal-layer { top: 0; height: 100dvh; }
html.tw-course-banner-visible .tt-modal-layer { top: var(--tw-course-banner-height, 0px); height: calc(100dvh - var(--tw-course-banner-height, 0px)); }
.tt-modal-positioner { min-height: 100%; }
.tt-modal-layer .tt-modal { max-height: calc(100dvh - var(--tw-course-banner-height, 0px) - 32px) !important; }
@media (max-width: 640px) {
  .tt-modal-positioner { padding: 8px; }
  .tt-modal-layer .tt-modal { max-height: calc(100dvh - var(--tw-course-banner-height, 0px) - 16px) !important; }
}

/* v3.10.22: stable modal header/body and backdrop closing */
.tt-modal-layer .tt-modal{
  display:flex;
  flex-direction:column;
  overflow:hidden !important;
}
.tt-modal-layer .tt-modal__header{
  position:relative;
  z-index:30;
  flex:0 0 auto;
  background:#fff;
  box-shadow:0 1px 0 rgba(15,23,42,.08);
}
.dark .tt-modal-layer .tt-modal__header{background:#111827;}
.tt-modal-layer .tt-modal__body{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overscroll-behavior:contain;
}
