:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #19212e;
  background: #fff;
  font-synthesis: none;
  font-size: 16px;
  --mint: #67c9a8;
  --muted: #7d8798;
  --line: #dce1e8;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
  border: 0;
}
button:disabled {
  cursor: wait;
  opacity: 0.65;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 3px solid #67c9a8;
  outline-offset: 4px;
}
#locked {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}
.unlock {
  width: 420px;
  max-width: 100%;
  text-align: left;
}
.lock-mark {
  width: 48px;
  height: 56px;
  display: block;
  margin: 0 auto 28px;
  fill: #e5f6ef;
  stroke: #52bd96;
  stroke-width: 3.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
h1 {
  font-size: 32px;
  letter-spacing: -0.7px;
  margin: 0;
  line-height: 1.2;
}
.unlock h1,
.intro {
  text-align: center;
}
.intro {
  color: var(--muted);
  margin: 12px 0 40px;
  line-height: 1.6;
}
.connection {
  border: 1px solid var(--line);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  min-height: 56px;
}
.connection label {
  white-space: nowrap;
}
.connection input {
  width: 130px;
  color: transparent;
  cursor: pointer;
  font-size: 13px;
}
.connection input::file-selector-button {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f5f7f9;
  padding: 8px 12px;
  color: #19212e;
  cursor: pointer;
}
.hint {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  margin: 8px 0 30px;
}
.secret-label {
  display: block;
  margin-bottom: 10px;
}
#secret {
  width: 100%;
  height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.recovery {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 30px;
  font-size: 15px;
}
.recovery input {
  width: 19px;
  height: 19px;
  accent-color: #43b18a;
}
.primary {
  width: 100%;
  background: var(--mint);
  color: #fff;
  border-radius: 7px;
  padding: 17px;
  font-weight: 650;
}
.privacy {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  margin: 30px 0 0;
}
#login-error {
  color: #a63832;
  font-size: 14px;
  line-height: 1.6;
  min-height: 20px;
}
#library {
  display: flex;
  min-height: 100dvh;
}
aside {
  position: sticky;
  top: 0;
  width: 220px;
  flex-shrink: 0;
  background: #f1f3f5;
  height: 100dvh;
  padding: 36px 14px 26px;
  display: flex;
  flex-direction: column;
}
aside h2 {
  font-size: 25px;
  letter-spacing: -0.5px;
  margin: 0 10px 24px;
}
nav {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
nav button,
.lock-button {
  text-align: left;
  border-radius: 7px;
  padding: 13px 16px;
  background: transparent;
  color: #19212e;
  font-size: 16px;
}
nav button:hover,
.lock-button:hover {
  background: #e7ecef;
}
nav button.selected {
  background: #dcefeb;
  color: #146d58;
}
.lock-button {
  margin-top: auto;
}
.content {
  min-width: 0;
  width: 100%;
  padding: 36px 30px;
}
header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: 0 8px 30px;
}
header p {
  color: var(--muted);
  margin: 9px 0 0;
}
.secondary {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  font-size: 14px;
  white-space: nowrap;
}
#gallery-status {
  font-size: 14px;
  color: var(--muted);
  margin: 0 8px 20px;
  line-height: 1.5;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
}
.tile {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 7px;
  background: #edf0f3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #627183;
  padding: 0;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tile:hover {
  filter: brightness(0.94);
}
.video-mark {
  position: absolute;
  bottom: 9px;
  right: 9px;
  border-radius: 4px;
  color: white;
  background: #0008;
  padding: 4px 8px;
  font-size: 13px;
}
.placeholder {
  font-size: 15px;
  line-height: 1.6;
  text-align: center;
  padding: 20px;
}
.album {
  aspect-ratio: auto;
  min-height: 140px;
  flex-direction: column;
  padding: 22px;
  gap: 12px;
  text-align: left;
  background: #f1f3f5;
  align-items: flex-start;
  font-weight: 600;
}
.album small {
  font-weight: 400;
  color: var(--muted);
}
dialog {
  border: 0;
  border-radius: 12px;
  width: calc(100vw - 60px);
  height: calc(100dvh - 60px);
  max-width: 1400px;
  max-height: 1000px;
  padding: 0;
  background: #111720;
  color: #fff;
}
dialog::backdrop {
  background: #000b;
}
.viewer-toolbar {
  height: 62px;
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.viewer-toolbar button {
  background: #ffffff14;
  color: #fff;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  font-size: 26px;
}
#viewer-label {
  margin-right: auto;
  font-size: 14px;
  color: #c9d0db;
}
#viewer-content {
  height: calc(100% - 110px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 20px;
}
#viewer-content img,
#viewer-content video {
  display: block;
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}
#viewer-status {
  text-align: center;
  color: #cad1db;
  font-size: 14px;
  margin: 12px;
  padding: 0 20px;
}
@media (min-width: 1500px) {
  .gallery {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}
@media (max-width: 950px) {
  aside {
    width: 180px;
  }
  .content {
    padding: 28px 20px;
  }
  .gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  #library {
    display: block;
  }
  aside {
    position: relative;
    width: 100%;
    height: auto;
    padding: 20px;
  }
  aside h2 {
    font-size: 22px;
    margin: 0 0 16px;
  }
  nav {
    flex-direction: row;
    overflow: auto;
    gap: 4px;
  }
  nav button {
    font-size: 13px;
    padding: 10px;
    white-space: nowrap;
  }
  .lock-button {
    position: absolute;
    top: 13px;
    right: 14px;
    font-size: 13px;
  }
  .content {
    padding: 24px 16px;
  }
  header {
    margin: 0 0 24px;
  }
  header h1 {
    font-size: 27px;
  }
  header p {
    font-size: 14px;
  }
  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  dialog {
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
  }
  .intro {
    font-size: 15px;
  }
  .connection {
    padding: 12px;
  }
  .unlock {
    width: 380px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .tile {
    transition: filter 0.12s;
  }
}
:is(nav button, .lock-button, .connection label, .secondary) {
  display: flex;
  align-items: center;
  gap: 13px;
}
.ui-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.secondary {
  gap: 9px;
}
.secondary .ui-icon {
  width: 17px;
  height: 17px;
}
.connection label .ui-icon {
  width: 20px;
  height: 20px;
}
.secret-field {
  position: relative;
}
.secret-field #secret {
  padding-right: 50px;
}
#show-secret {
  position: absolute;
  right: 10px;
  top: 8px;
  width: 34px;
  height: 32px;
  background: transparent;
  color: #7d8798;
  display: grid;
  place-items: center;
}
#show-secret .ui-icon {
  width: 20px;
  height: 20px;
}

aside select, aside input {width:100%;margin:8px 0 16px;padding:10px;border:1px solid #dfe8e4;border-radius:8px;background:white;color:#24372f;} aside label{font-size:13px;color:#50645b;} #create-user-form{margin-top:18px;} #admin-status{font-size:12px;color:#50645b;}

#password-fields { margin: 24px 0; }
#confirm-field { margin-top: 18px; }
#confirm-secret { width: 100%; height: 48px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 7px; }
.remember { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.remember input { accent-color: #43b18a; width: 18px; height: 18px; }
.text-button { display: block; margin: 12px auto 0; background: transparent; color: #687486; font-size: 14px; padding: 10px; }

#chat-threads { display: grid; gap: 12px; }
.chat-row { margin: 16px 0; padding: 16px; background: #f0f3f2; color: #14241d; border-radius: 14px; overflow-wrap: anywhere; }
.chat-row p { white-space: pre-wrap; }
.chat-media { display: block; max-width: 100%; max-height: 65vh; margin-top: 12px; }
