/* Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  min-width: 0;
}

html {
  font-size: 16px;
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
}

body {
  min-height: 100vh;
  background-color: #ffffff;
  color: #000000;
}

/* App shell */
.app-shell {
  width: min(1000px, calc(100% - 6rem));
  margin: 0 auto;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
}

.app-header__identity {
  display: inline-flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.app-header__brand {
  margin: 0;
  font-family: "Departure Mono", monospace;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #0c3eff;
}

.app-header__meta {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: #64748b;
}

.app-header__meta--strong {
  color: #0f172a;
  font-family: "Departure Mono", monospace;
  font-weight: 700;
}

.auth-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  width: auto;
}

.auth-controls__profile,
.auth-controls__logout {
  border: 1px solid #0f172a;
  border-radius: 0;
  background: #ffffff;
  color: #0f172a;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.auth-controls__profile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.64rem;
  min-width: 2.65rem;
  height: 2.64rem;
  padding: 0;
}

.auth-controls__profile-icon {
  width: 1.2rem;
  height: 1.2rem;
}

.auth-controls__logout {
  padding: 0.62rem 0.95rem;
}

@media (hover: hover) {
  .auth-controls__profile:hover,
  .auth-controls__logout:hover {
    background-color: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
  }
}

.auth-controls__profile:focus-visible,
.auth-controls__logout:focus-visible {
  outline: none;
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

.auth-controls__profile:disabled,
.auth-controls__logout:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Divider */
.divider {
  margin-block: 2rem;
}

/* Section Layout */
.updates-section,
.domains-section,
.projects-section,
.finance-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "header controls"
    "shell shell";
  align-items: end;
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.section-header {
  grid-area: header;
}

.section-title {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.section-controls {
  grid-area: controls;
  display: flex;
  gap: 0.5rem;
}

.section-compose-toggle,
.section-toggle {
  border: 1px solid #0f172a;
  border-radius: 0;
  background-color: #000000;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  width: 2.5rem;
  min-width: 2.5rem;
  height: 2.5rem;
  line-height: 1;
  transition:
    background-color 160ms ease,
    border-color 160ms ease;
}

.section-compose-toggle {
  font-size: 1.15rem;
}

.section-toggle {
  font-size: 1rem;
  white-space: nowrap;
  text-align: center;
  justify-self: start;
}

@media (hover: hover) {
  .section-compose-toggle:hover,
  .section-toggle:hover {
    background-color: #341455;
    border-color: #334144;
  }
}

.section-compose-toggle:focus-visible,
.section-toggle:focus-visible {
  background-color: #334155;
  border-radius: 0;
  outline: none;
}

.section-log-toggle {
  border: 1px solid #0f172a;
  border-radius: 0;
  background-color: #ffffff;
  color: #0f172a;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  min-width: 0;
  height: 2.5rem;
  padding: 0 0.9rem;
  white-space: nowrap;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

@media (hover: hover) {
  .section-log-toggle:hover {
    background-color: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
  }
}

.section-log-toggle:focus-visible {
  outline: none;
  background-color: #334155;
  border-color: #334155;
  color: #ffffff;
}

.section-shell {
  grid-area: shell;
}

.section-content {
  border: 1px solid #d9e2ec;
  border-radius: 0;
  background-color: #ffffff;
  overflow: hidden;
}

.section-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.section-composer {
  display: grid;
  gap: 0.85rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid #d9e2ec;
}

.section-composer[hidden] {
  display: none;
}
.section-composer__label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #64748b;
}

.section-composer__textarea,
.section-composer__input {
  width: 100%;
  border: 1px solid #cbd5e1;
  padding: 0.9rem 1rem;
  border-radius: 0;
  background-color: #ffffff;
  color: #0f172a;
  font: inherit;
  min-height: 1.5rem;
}

.section-composer__textarea {
  min-height: 140px;
  resize: vertical;
}

.section-composer__textarea:focus,
.section-composer__input:focus {
  outline: none;
  border-color: #0f172a;
}

.section-composer__actions {
  display: flex;
  gap: 0.75rem;
}

.section-composer__save,
.section-composer__cancel {
  padding: 0.7rem 1rem;
  border: 1px solid #0f172a;
  border-radius: 0;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.section-composer__save {
  background-color: #0f172a;
  color: #ffffff;
}

.section-composer__cancel {
  background-color: #ffffff;
  color: #0f172a;
}

.section-composer--standalone {
  border: 1px solid #d9e2ec;
}

.section-composer__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.section-composer__field-group {
  display: grid;
  gap: 0.5rem;
}

.section-empty {
  margin: 0;
  padding: 1.25rem 1.5rem;
  font-size: 0.95rem;
  color: #64748b;
}

/* Profile Page */
.profile-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "header"
    "shell";
  gap: 1.25rem;
  margin-bottom: 3rem;
}

.profile-section .section-header {
  grid-area: header;
}

.section-header-text {
  margin-top: 0.5rem;
}

.profile-section .section-shell {
  grid-area: shell;
}

.profile-form {
  border-top: 0;
  padding: 1.5rem;
}

.profile-form__grid {
  display: grid;
  gap: 1rem;
}

.profile-form__row {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 1rem;
  align-items: center;
}

.profile-form__label {
  margin: 0;
}

.profile-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid #d9e2ec;
}

@media (max-width: 720px) {
  #profile-back-button {
    width: 100%;
  }

  .profile-form {
    padding: 1rem;
  }

  .profile-form__row {
    grid-template-columns: 1fr;
    gap: 0.5rem;
    align-items: start;
  }

  .profile-form__actions {
    justify-content: stretch;
    flex-direction: column;
  }

  .profile-form__actions .section-composer__save,
  .profile-form__actions .section-composer__cancel {
    width: 100%;
  }
}

/* Updates */
.update-row {
  display: grid;
  gap: 0.6rem 1rem;
  padding: 1.25rem 1.5rem;
  background-color: #fbfbfb;
}

.update-row + .update-row {
  border-top: 1px solid #d9e2ec;
}

.update-row__meta {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.update-row__text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: #334155;
  white-space: pre-wrap;
}

.entity-row__footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.6rem;
  grid-column: 1 / -1;
}

.entity-row__byline {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}

.byline__label {
  color: #5a6d7e;
  font-size: 0.7rem;
}

.byline__value {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.update-row__actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.update-row__edit,
.update-row__delete {
  padding: 0.25rem 0.5rem;
  border: 1px solid #0f172a;
  background: #ffffff;
  color: #0f172a;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Finance and Domains */
.domain-row,
.finance-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  background-color: #fbfbfb;
}

.domain-row + .domain-row,
.finance-row + .finance-row {
  border-top: 1px solid #d9e2ec;
}

.domain-row__main {
  display: grid;
  gap: 0.5rem;
}

.finance-row__main {
  display: grid;
  gap: 0.25rem;
}

.domain-row__name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.2;
  color: #0f172a;
}

.domain-row__meta {
  display: grid;
  align-items: baseline;
  gap: 0.15rem;
}

.domain-row__meta {
  display: grid;
  align-items: baseline;
  gap: 0.15rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.domain-row__meta-span {
  font-weight: 600;
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0.02em;
  color: #334155;
}

.domain-row__side,
.finance-row__side {
  display: grid;
  gap: 0.15rem;
  text-align: right;
}

.domain-row__date,
.finance-row__date {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: #334155;
}

.finance-row__label {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
}

.finance-row__amount {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  text-align: right;
}

.domain-row__expires,
.finance-row__installment {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  text-align: right;
}

.domain-row__actions,
.finance-row__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  grid-column: 1 / -1;
}

.domain-row__edit,
.domain-row__delete,
.finance-row__edit,
.finance-row__delete {
  padding: 0.25rem 0.5rem;
  background: #ffffff;
  color: #0f172a;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Every edit and delete buttons */

.domain-row__edit,
.update-row__edit,
.project-card__edit,
.finance-row__edit {
  border: 1px solid #334155;
  color: #334155;
}

.domain-row__delete,
.update-row__delete,
.project-card__delete,
.finance-row__delete {
  border: 1px solid #991b1b;
  color: #991b1b;
}

/* Projects */
.projects-section__shell {
  display: grid;
  gap: 1rem;
}

.project-groups {
  display: grid;
  gap: 1.5rem;
}

.project-group {
  display: grid;
  gap: 1rem;
}

.project-group__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #0f172a;
}

.projects-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.project-section-empty {
  margin: 0;
  border: 1px solid #d9e2ec;
  padding: 1.25rem 1.5rem;
  font-size: 0.95rem;
  color: #64748b;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid #d9e2ec;
  border-radius: 0;
  background-color: #fbfbfb;
}

.project-card__top {
  display: block;
}

.project-card__name {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.25;
}

.project-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: flex-start;
}

.project-card__tag {
  flex-shrink: 0;
  margin: 0;
  padding: 0.25rem 0.5rem;
  border-radius: 0;
  background-color: #e2e8f0;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.project-card__description {
  margin: 0;
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #475569;
}

.project-composer__textarea {
  grid-column: 1 / -1;
}

.project-composer__actions {
  grid-column: 1 / -1;
}

.project-card__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
}

.project-card__footer {
  margin-top: auto;
}

.project-card__delete,
.project-card__edit {
  padding: 0.25rem 0.5rem;
  background: #ffffff;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.project-logs-panel {
  border: 1px solid #d9e2ec;
  background-color: #ffffff;
}

.section-logs-panel {
  border-top: 1px solid #d9e2ec;
  background-color: #ffffff;
}

.project-logs-panel__header,
.section-logs-panel__header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #d9e2ec;
  background-color: #f8fafc;
}

.project-logs-panel__title,
.section-logs-panel__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #0f172a;
}

.project-logs-list,
.section-logs-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.project-log-row,
.section-log-row {
  display: grid;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background-color: #fbfbfb;
}

.project-log-row + .project-log-row,
.section-log-row + .section-log-row {
  border-top: 1px solid #d9e2ec;
}

.project-log-row__meta,
.section-log-row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 0.9rem;
}

.project-log-row__action,
.section-log-row__action {
  margin: 0;
  padding: 0.18rem 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 0;
}

.project-log-row__action--create,
.section-log-row__action--create {
  background-color: #dcfce7;
  color: #166534;
}

.project-log-row__action--update,
.section-log-row__action--update {
  background-color: #dbeafe;
  color: #1d4ed8;
}

.project-log-row__action--delete,
.section-log-row__action--delete {
  background-color: #fee2e2;
  color: #991b1b;
}

.project-log-row__time,
.section-log-row__time {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #64748b;
}

.project-log-row__summary,
.section-log-row__summary {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #0f172a;
}

.project-log-row__details,
.section-log-row__details {
  margin: 0;
  padding-left: 1rem;
  display: grid;
  gap: 0.35rem;
}

.project-log-row__detail,
.project-log-row__snapshot,
.section-log-row__detail,
.section-log-row__snapshot {
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Auth Page */
.page {
  min-height: 100dvh;
  margin: 0;
  padding: 1rem;
  display: grid;
  place-items: center;
}

.auth-page {
  width: min(100%, 460px);
}

.auth-page__header {
  text-align: center;
  margin-bottom: 1rem;
}

.auth-page__title {
  margin: 0;
  font-family: "Departure Mono", monospace;
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  color: #0c3eff;
}

.auth-page__subtitle {
  margin: 0.5rem 0 0;
  color: #475569;
  font-size: 0.95rem;
}

.auth-panel {
  border: 1px solid #d4d4d8;
  background: #ffffff;
  padding: 1rem;
  display: grid;
  gap: 0.9rem;
}

.auth-panel .auth-form {
  border: 0;
  padding: 0;
}

.auth-controls .auth-form__label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #475569;
}

.auth-controls .auth-form__input {
  width: 100%;
  border: 1px solid #cbd5e1;
  padding: 0.58rem 0.72rem;
  border-radius: 0;
  background-color: #ffffff;
  color: #0f172a;
  font: inherit;
  min-height: 2.2rem;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.auth-controls .auth-form__input:focus-visible {
  outline: none;
  border-color: #0c3eff;
  box-shadow: 0 0 0 2px rgb(12 62 255 / 14%);
}

.auth-controls .auth-form__submit {
  border: 1px solid #0f172a;
  background: #0f172a;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  padding: 0.62rem 0.8rem;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    border-color 140ms ease;
}

@media (hover: hover) {
  .auth-controls .auth-form__submit:hover {
    background-color: #0c3eff;
    border-color: #0c3eff;
  }
}

.auth-controls .auth-form__submit:focus-visible {
  outline: none;
  background-color: #0c3eff;
  border-color: #0c3eff;
}

.auth-controls .auth-form__submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-panel .auth-form__label {
  display: block;
  margin: 0 0 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #475569;
}

.auth-panel .auth-form__input {
  width: 100%;
  border: 1px solid #cbd5e1;
  padding: 0.78rem 0.9rem;
  border-radius: 0;
  background-color: #ffffff;
  color: #0f172a;
  font: inherit;
  margin-bottom: 0.78rem;
  min-height: 2.45rem;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.auth-panel .auth-form__input::placeholder {
  color: #94a3b8;
}

.auth-panel .auth-form__input:focus-visible {
  outline: none;
  border-color: #0c3eff;
  box-shadow: 0 0 0 2px rgb(12 62 255 / 14%);
}

.auth-panel .auth-form__submit {
  width: 100%;
  border: 1px solid #0f172a;
  background: #0f172a;
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.72rem 0.9rem;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    border-color 140ms ease;
}

@media (hover: hover) {
  .auth-panel .auth-form__submit:hover {
    background-color: #0c3eff;
    border-color: #0c3eff;
  }
}

.auth-panel .auth-form__submit:focus-visible {
  outline: none;
  background-color: #0c3eff;
  border-color: #0c3eff;
}

.auth-panel .auth-form__submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.auth-message {
  margin: 0;
  color: #166534;
  font-size: 0.9rem;
}

.auth-panel .auth-error {
  margin: 0;
  grid-column: auto;
}

/* Responsive */
@media (max-width: 640px) {
  .section-log-toggle {
    width: 100%;
    min-width: 0;
  }

  .app-shell {
    width: min(1000px, calc(100% - 1.5rem));
  }

  .app-header__identity {
    justify-content: center;
  }

  .divider {
    margin-block: 1rem;
  }

  .auth-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    width: 100%;
  }

  .auth-controls__profile,
  .auth-controls__logout {
    width: 100%;
    min-width: 0;
    height: 2.65rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .auth-controls__logout {
    padding: 0;
  }

  .updates-section,
  .domains-section,
  .projects-section,
  .finance-section {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "shell"
      "controls";
  }

  .section-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .section-compose-toggle,
  .section-toggle {
    width: 100%;
    min-width: 0;
  }

  .section-composer__actions {
    flex-direction: column;
  }

  .section-composer__grid {
    grid-template-columns: 1fr;
  }

  .section-composer__input[type="number"] {
    min-height: 3.9rem;
    font-size: 1.05rem;
  }

  .section-composer__input[type="number"]::-webkit-outer-spin-button,
  .section-composer__input[type="number"]::-webkit-inner-spin-button {
    margin: 0;
    min-height: 3.2rem;
    opacity: 1;
  }

  .domain-row,
  .finance-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .domain-row__main {
    gap: 1rem;
  }

  .domain-row__side,
  .domain-row__expires,
  .finance-row__side,
  .finance-row__amount,
  .finance-row__installment {
    text-align: left;
  }

  .projects-list {
    grid-template-columns: 1fr;
  }

  .project-card__top {
    flex-direction: column;
    align-items: flex-start;
  }

  .project-card__actions,
  .domain-row__actions,
  .finance-row__actions {
    display: flex;
    justify-content: flex-start;
  }
}

@font-face {
  font-family: "Departure Mono";
  src: url("./fonts/departure-mono.woff") format("woff");
  font-display: swap;
  font-weight: 500;
  font-style: normal;
}
