*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  color: #121212;
  background: #ffffff;
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page {
  min-height: 100vh;
  width: min(760px, 100%);
  margin: 0 auto;
  padding: 18px 18px 32px;
}

.center {
  display: grid;
  place-items: center;
  width: 100%;
}

.box {
  border: 1px solid #e5e5e5;
  background: #fff;
}

.login-box,
.status-box {
  width: min(360px, 100%);
  padding: 26px 0;
  border: 0;
}

.status-box {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
}

.status-box h1,
.status-box p {
  margin: 0;
}

.status-box p {
  color: #777;
}

.brand {
  display: inline-flex;
  justify-content: center;
  align-items: baseline;
  gap: 1px;
  color: #2f78ff;
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-weight: 900;
  line-height: 0.85;
  letter-spacing: -0.04em;
  white-space: nowrap;
  user-select: none;
}

.brand span {
  display: inline-block;
}

.brand span + span {
  color: #df2b22;
}

.brand.small {
  font-size: 2rem;
}

.brand.large {
  display: flex;
  width: max-content;
  margin-bottom: 34px;
  margin-left: auto;
  margin-right: auto;
  font-size: clamp(5rem, 22vw, 7rem);
}

.topbar {
  display: grid;
  grid-template-columns: 80px 1fr 80px;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.text-button {
  width: max-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: #222;
  font-size: 0.9rem;
  font-weight: 700;
  justify-self: start;
}

.text-button:hover {
  color: #2f78ff;
}

.topbar .text-button:last-child {
  justify-self: end;
}

.menu {
  display: grid;
  width: min(440px, 100%);
  margin: clamp(36px, 8vh, 70px) auto 0;
}

.home-photo {
  width: 100%;
  margin: 0 0 24px;
  border-bottom: 1px solid #e8e8e8;
  padding-bottom: 18px;
}

.home-photo img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  background: #f5f5f5;
}

.home-photo__button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.home-photo time {
  display: block;
  margin-top: 8px;
  color: #777;
  font-size: 0.82rem;
}

.home-photo figcaption {
  margin-top: 8px;
  color: #555;
  font-size: 0.9rem;
  line-height: 1.35;
}

.empty-photo {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: #999;
  font-size: 0.9rem;
  text-align: center;
}

.menu-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 0;
  border: 0;
  border-top: 1px solid #e8e8e8;
  background: transparent;
  color: #121212;
  font-size: 1.05rem;
  font-weight: 800;
  text-align: left;
}

.menu-button:last-child {
  border-bottom: 1px solid #e8e8e8;
}

.menu-button em {
  color: #999;
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 700;
}

.menu-button.blue:hover {
  color: #2f78ff;
}

.menu-button.red:hover {
  color: #df2b22;
}

.hero {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 260px;
  margin-bottom: 20px;
  border: 0;
  border-bottom: 1px solid #e8e8e8;
  background: #fff;
  text-align: center;
}

.hero span {
  color: #777;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero strong {
  font-family: Arial Black, Arial, Helvetica, sans-serif;
  font-size: clamp(5.5rem, 27vw, 10rem);
  line-height: 0.82;
  font-weight: 900;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.hero--duration strong {
  font-size: clamp(3rem, 15vw, 6.4rem);
  line-height: 0.9;
}

.hero.blue strong,
.round.blue {
  color: #2f78ff;
}

.hero.red strong,
.round.red {
  color: #df2b22;
}

.hero small {
  color: #777;
  font-size: 0.9rem;
  font-weight: 700;
}

.controls {
  width: min(440px, 100%);
  margin: 0 auto 20px;
  padding: 0 0 18px;
  border: 0;
  border-bottom: 1px solid #e8e8e8;
}

.form {
  display: grid;
  gap: 13px;
}

.form.compact {
  gap: 12px;
}

label {
  position: relative;
  display: grid;
  gap: 6px;
}

.with-attach {
  gap: 0;
}

.with-attach input {
  padding-right: 52px;
}

.with-attach textarea {
  min-height: 96px;
  max-height: 180px;
  padding: 12px 52px 12px 12px;
  resize: none;
  overflow-y: auto;
}

label span {
  color: #777;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d7d7d7;
  border-radius: 0;
  padding: 0 12px;
  background: #fff;
  color: #121212;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #121212;
}

.main-button {
  min-height: 46px;
  border: 0;
  border-radius: 0;
  background: #121212;
  color: #fff;
  font-weight: 900;
}

.main-button.secondary {
  border: 1px solid #121212;
  background: #fff;
  color: #121212;
}

.duration-picker {
  display: block;
}

.duration-picker input {
  min-height: 54px;
  font-weight: 800;
}

.duration-picker input::-webkit-calendar-picker-indicator {
  opacity: 0.8;
}

.file-input {
  display: none;
}

.file-names {
  margin: -2px 0 0;
  color: #777;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding-top: 4px;
}

.round {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid #d7d7d7;
  border-radius: 999px;
  background: #fff;
  font-size: 2rem;
  line-height: 1;
  font-weight: 700;
}

.round:hover {
  border-color: currentColor;
}

.segment {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid #d7d7d7;
}

.segment--late {
  border: 0;
  display: grid;
  gap: 8px;
}

.segment--late .segment__button {
  min-height: 44px;
  border: 1px solid #d7d7d7;
  background: rgba(47, 120, 255, 0.08);
  color: #245fcb;
}

.segment--late .segment__button--red {
  background: rgba(223, 43, 34, 0.08);
  color: #c9241d;
}

.segment--late .segment__button.active {
  color: #fff;
}

.segment--late .segment__button--blue.active {
  background: rgba(47, 120, 255, 0.9);
}

.segment--late .segment__button--red.active {
  background: rgba(223, 43, 34, 0.9);
}

.segment button {
  min-height: 42px;
  border: 0;
  background: #fff;
  color: #777;
  font-weight: 850;
}

.segment button + button {
  border-left: 1px solid #d7d7d7;
}

.segment button.active {
  background: #121212;
  color: #fff;
}

.message {
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid currentColor;
  font-size: 0.9rem;
  font-weight: 750;
}

.message.error {
  color: #be123c;
}

.message.success {
  color: #16703c;
}

.history {
  width: min(520px, 100%);
  margin: 0 auto;
  padding: 0;
  border: 0;
}

.diary {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.album-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border: 1px solid #e5e5e5;
  background: #fff;
}

.album-card--add {
  display: grid;
  place-items: center;
  padding: 0;
  color: #121212;
  font-size: 4rem;
  line-height: 1;
}

.album-card--add:hover {
  border-color: #121212;
}

.album-composer {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
}

.album-composer__field textarea {
  min-height: 120px;
  max-height: 220px;
  padding: 12px;
  resize: none;
  overflow-y: auto;
}

.album-preview {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid #e5e5e5;
  background: #f5f5f5;
}

.album-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.album-composer__actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.album-photo {
  padding: 0;
  cursor: pointer;
}

.album-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #f5f5f5;
}

.composer-modal {
  position: fixed;
  inset: 0;
  z-index: 21;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 18, 18, 0.4);
}

.composer-modal__panel {
  position: relative;
  width: min(420px, 100%);
  min-height: auto;
  aspect-ratio: auto;
  background: #fff;
}

.composer-modal__close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: #121212;
  font-size: 1.8rem;
  line-height: 1;
}

.attach {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  background: transparent;
  color: #888;
}

.attach.on {
  color: #121212;
}

.attach b {
  position: absolute;
  top: -3px;
  right: -1px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #121212;
  color: #fff;
  font-size: 0.67rem;
  line-height: 16px;
}

.expandable-note {
  display: grid;
  gap: 6px;
}

.expandable-note__text {
  max-height: 6.3em;
  overflow: hidden;
  white-space: pre-wrap;
  word-break: break-word;
}

.expandable-note__text.is-open {
  max-height: none;
}

.expandable-note__text--scroll {
  max-height: min(20vh, 220px);
  overflow-y: auto;
}

.expandable-note__toggle {
  color: #777;
  font-size: 0.82rem;
  font-weight: 700;
}

.preview-note {
  padding: 12px;
  border: 1px solid #e5e5e5;
}

.history h2 {
  margin: 0 0 8px;
  color: #777;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.history article {
  display: grid;
  gap: 6px;
  padding: 13px 0;
  border-top: 1px solid #e8e8e8;
}

.history article:last-child {
  border-bottom: 1px solid #e8e8e8;
}

.history article div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.history p {
  margin: 0;
  color: #555;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.history time {
  color: #999;
  font-size: 0.78rem;
}

.pos {
  color: #16703c;
}

.neg {
  color: #df2b22;
}

.photos {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
}

.photos img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 0;
  background: #f5f5f5;
}

.empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  margin: 0;
  color: #999;
  border: 1px solid #e8e8e8;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 64px;
  align-items: center;
  padding: 0;
  background: rgba(18, 18, 18, 0.84);
}

.lightbox--home {
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
}

.lightbox__panel {
  width: 100vw;
  height: 100vh;
  margin: 0;
  background: #000;
}

.lightbox:not(.lightbox--home) .lightbox__panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: #000;
}

.lightbox__panel--home {
  width: 100vw;
}

.lightbox__panel--home img {
  max-height: 82vh;
}

.lightbox__media {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #000;
}

.lightbox__panel img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  touch-action: none;
  user-select: none;
  transition: transform 120ms ease;
}

.lightbox:not(.lightbox--home) .lightbox__panel img {
  background: #000;
}

.lightbox__meta {
  display: grid;
  gap: 8px;
  padding: 14px 18px 18px;
  max-height: min(28vh, 280px);
  overflow-y: auto;
}

.lightbox:not(.lightbox--home) .lightbox__meta {
  align-content: end;
  background: #000;
}

.lightbox__meta p,
.lightbox__meta time {
  margin: 0;
}

.lightbox:not(.lightbox--home) .lightbox__meta p,
.lightbox:not(.lightbox--home) .lightbox__meta time {
  color: #fff;
}

.lightbox__meta time {
  color: #777;
  font-size: 0.82rem;
}

.lightbox:not(.lightbox--home) .lightbox__meta time {
  color: rgba(255, 255, 255, 0.72);
}

.lightbox__actions {
  padding-top: 4px;
}

.lightbox__close,
.lightbox__nav {
  border: 0;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.lightbox__close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  font-size: 2rem;
  line-height: 1;
}

.lightbox__nav {
  width: 48px;
  height: 96px;
  font-size: 2.4rem;
}

.lightbox__nav:disabled {
  opacity: 0.2;
}

.loader {
  width: 26px;
  height: 26px;
  border: 2px solid #ddd;
  border-top-color: #121212;
  border-radius: 999px;
  animation: spin 800ms linear infinite;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 10;
  max-width: min(420px, calc(100% - 28px));
  padding: 11px 13px;
  background: #121212;
  color: #fff;
}

.toast.error {
  background: #be123c;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 520px) {
  .page {
    padding: 14px;
  }

  .topbar {
    grid-template-columns: 70px 1fr 70px;
  }

  .hero {
    min-height: 245px;
  }

  .album-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lightbox {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    padding: 12px;
  }

  .lightbox__nav {
    height: 72px;
  }

  .composer-modal {
    padding: 12px;
  }
}
