.counter {
  font-size: 16px;
  padding: 5px 10px;
  border-radius: 5px;
  color: var(--accent);
  background: var(--accent-bg);
  border: 2px solid transparent;
  transition: border-color 0.3s;
  margin-bottom: 24px;

  &:hover {
    border-color: var(--accent-border);
  }
  &:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
  }
}

.hero {
  position: relative;

  .base,
  .framework,
  .vite {
    inset-inline: 0;
    margin: 0 auto;
  }

  .base {
    width: 170px;
    position: relative;
    z-index: 0;
  }

  .framework,
  .vite {
    position: absolute;
  }

  .framework {
    z-index: 1;
    top: 34px;
    height: 28px;
    transform: perspective(2000px) rotateZ(300deg) rotateX(44deg) rotateY(39deg)
      scale(1.4);
  }

  .vite {
    z-index: 0;
    top: 107px;
    height: 26px;
    width: auto;
    transform: perspective(2000px) rotateZ(300deg) rotateX(40deg) rotateY(39deg)
      scale(0.8);
  }
}

#center {
  display: flex;
  flex-direction: column;
  gap: 25px;
  place-content: center;
  place-items: center;
  flex-grow: 1;

  @media (max-width: 1024px) {
    padding: 32px 20px 24px;
    gap: 18px;
  }
}

#next-steps {
  display: flex;
  border-top: 1px solid var(--border);
  text-align: left;

  & > div {
    flex: 1 1 0;
    padding: 32px;
    @media (max-width: 1024px) {
      padding: 24px 20px;
    }
  }

  .icon {
    margin-bottom: 16px;
    width: 22px;
    height: 22px;
  }

  @media (max-width: 1024px) {
    flex-direction: column;
    text-align: center;
  }
}

#docs {
  border-right: 1px solid var(--border);

  @media (max-width: 1024px) {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}

#next-steps ul {
  list-style: none;
  padding: 0;
  display: flex;
  gap: 8px;
  margin: 32px 0 0;

  .logo {
    height: 18px;
  }

  a {
    color: var(--text-h);
    font-size: 16px;
    border-radius: 6px;
    background: var(--social-bg);
    display: flex;
    padding: 6px 12px;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: box-shadow 0.3s;

    &:hover {
      box-shadow: var(--shadow);
    }
    .button-icon {
      height: 18px;
      width: 18px;
    }
  }

  @media (max-width: 1024px) {
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;

    li {
      flex: 1 1 calc(50% - 8px);
    }

    a {
      width: 100%;
      justify-content: center;
      box-sizing: border-box;
    }
  }
}

#spacer {
  height: 88px;
  border-top: 1px solid var(--border);
  @media (max-width: 1024px) {
    height: 48px;
  }
}

.ticks {
  position: relative;
  width: 100%;

  &::before,
  &::after {
    content: '';
    position: absolute;
    top: -4.5px;
    border: 5px solid transparent;
  }

  &::before {
    left: 0;
    border-left-color: var(--border);
  }
  &::after {
    right: 0;
    border-right-color: var(--border);
  }
}

/* ---------------------------------------------------------------------------
   Additions for the server-rendered rewrite.
   Everything above this line is carried over unchanged from the React app.
   --------------------------------------------------------------------------- */

/* Actions that changed the server used to be onClick handlers; they are now real
   forms. display:contents keeps the wrapping <form> out of the flex/grid layout
   so the button sits exactly where it did before. */
.navbar-signout-form,
.inline-action-form {
  display: contents;
}

/* Modals that became their own pages reuse the modal's action row, which was
   previously only ever inside .modal-panel. The buttons now sit outside the form
   and are wired to it with the `form` attribute, so the row is a direct child of
   the card. */
.card > .modal-actions {
  margin-top: 1.25rem;
}

/* The dashboard's status and text filters run in the browser, so Alpine hides
   cards by toggling this attribute before it has finished initialising. Without
   x-cloak every card flashes visible on first paint. */
[x-cloak] {
  display: none !important;
}

/* htmx swaps the confirmation dialog into this element; it has no box of its own. */
#modal-slot:empty {
  display: none;
}

/* Case cards were <button onClick={navigate}>; they are real links now, so they
   can be opened in a new tab. The base .case-card rules are class-based and
   already apply — only the hover state was written against the element. */
a.case-card {
  text-decoration: none;
}
a.case-card:hover {
  background: var(--surface);
  color: inherit;
  border-color: var(--border-soft);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
}

/* ---------------------------------------------------------------------------
   Deadlines ("Prazos")
   --------------------------------------------------------------------------- */

.deadline-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 900px) {
  .deadline-columns { grid-template-columns: 1fr; }
}

.deadline-column {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.1rem 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.deadline-card {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: var(--surface);
}

/* Closed cards stay readable but recede: they are history, not work. */
.deadline-card.closed {
  opacity: 0.55;
  background: var(--bg-app);
}

/* Case number, due date and the two tools on one row. Not space-between: with
   three children that would strand the due pill in the middle of a wide card.
   The number and the pill stay together on the left, and the actions are pushed
   right by their own margin instead. */
.deadline-card-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.deadline-card-head .case-number {
  text-decoration: none;
  white-space: nowrap;
}
.deadline-card-head .case-number:hover {
  text-decoration: underline;
}

.deadline-card-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  /* Pins the tools to the right edge however wide the card gets. */
  margin-left: auto;
}

.deadline-client {
  color: var(--text-ink);
  font-weight: 600;
  font-size: 0.95rem;
}

/* Which filing the deadline is for. Deliberately not a pill: this mirrors
   .case-part / .case-part-court on a case card, where the icon carries the
   colour and the label reads as plain text. Repeated here rather than sharing
   the .case-part rules, which belong to the case card, the same way
   .deadline-due below repeats the pill shape instead of reusing .pill. */
.deadline-status {
  display: inline-flex;
  align-self: flex-start;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  max-width: 100%;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Sized in em so the glyph tracks the label if its size is ever tuned. */
.deadline-status svg {
  flex: 0 0 auto;
  width: 1.25em;
  height: 1.25em;
  color: var(--pill-blue-fg);
}

.deadline-status-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pilled, like the status badge on a case card. It sits in the card's head row
   next to the case number, so it must not grow or shrink with the row. */
.deadline-due {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 0.35rem;
  max-width: 100%;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  background: var(--pill-gray-bg);
  color: var(--pill-gray-fg);
}
.deadline-due svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
}
.deadline-date { font-weight: 600; }

/* Amber for the coming week, red on the day itself and once overdue. The icon
   and the date inherit these, so one glyph covers every state. */
.deadline-due.urgency-warn {
  background: var(--pill-amber-bg);
  color: var(--pill-amber-fg);
}
.deadline-due.urgency-danger,
.deadline-due.urgency-overdue {
  background: var(--pill-red-bg);
  color: var(--pill-red-fg);
}

.deadline-comment {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-ink);
  white-space: pre-wrap;
}

.deadline-owner {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.deadline-closing {
  margin: 0.15rem 0 0;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-soft);
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: pre-wrap;
}

.icon-button-check:hover { color: var(--pill-green-fg); }

/* ---------------------------------------------------------------------------
   Histórico (the archive of closed cases)
   --------------------------------------------------------------------------- */

/* Wider than .container-wide, which the deadline board uses: this page carries
   five filters and a button on one row, and a five-column table under them.
   Loaded after index.css, so this overrides .container's max-width. */
.container-history {
  max-width: 1600px;
}

/* nowrap is the whole point — the toolbar is one line, and the fields share out
   whatever width there is rather than each holding a fixed basis and pushing
   the last one onto a second row. min-width:0 lets them actually shrink; without
   it a flex item refuses to go below its content's intrinsic width. */
.history-toolbar {
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.history-toolbar .filter-label {
  flex: 1 1 0;
  min-width: 0;
}

/* The two free-text boxes hold longer values than the three selects, so they
   take a proportionally larger share of the row. */
.history-toolbar .filter-label-wide {
  flex: 1.6 1 0;
}

/* Roomy padding is right on a form; across five side-by-side fields it is what
   pushes the row over the edge. */
.history-toolbar input,
.history-toolbar select {
  padding: 0.7rem 0.8rem;
  font-size: 0.88rem;
}
.history-toolbar select {
  background-position: right 0.65rem center;
  padding-right: 1.9rem;
}

.history-toolbar button[type="submit"] {
  flex: 0 0 auto;
  margin-bottom: 1px;
}

/* Below this the row genuinely cannot hold six controls, so let it wrap again
   and give the fields back a sensible basis. */
@media (max-width: 1150px) {
  .history-toolbar {
    flex-wrap: wrap;
    gap: 1rem;
  }
  .history-toolbar .filter-label,
  .history-toolbar .filter-label-wide {
    flex: 0 1 220px;
    min-width: 170px;
  }
}

.history-count {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* The whole row is clickable, so it should say so. The case number inside is a
   real link and keeps its own affordance. */
.history-table tbody tr {
  cursor: pointer;
}
.history-table .case-number {
  text-decoration: none;
  font-weight: 600;
}
.history-table .case-number:hover {
  text-decoration: underline;
}

/* Whitespace-only cells (no court, no updates) would collapse the row height. */
.history-table tbody td:empty::after {
  content: "—";
  color: var(--text-muted);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1.25rem;
}

/* Numbered pages are buttons for htmx's sake, but should read as links. */
.pagination-page {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
}
.pagination-page:hover {
  background: var(--input-bg);
  color: var(--text-ink);
}

.pagination-current {
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  background: var(--navy-deep);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
}

.pagination-gap {
  padding: 0.35rem 0.2rem;
  color: var(--text-muted);
}

/* Read-only summary on the close-deadline page. */
.detail-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 1rem;
  margin: 0 0 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.88rem;
}
.detail-list dt { color: var(--text-label); }
.detail-list dd { margin: 0; color: var(--text-ink); }

/* A disabled input still needs to look like information rather than a mistake. */
input[readonly][disabled] {
  color: var(--text-muted);
  cursor: default;
}

/* Feedback after a successful action, styled as the counterpart to .error. */
.success {
  color: #15803d;
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
}
