/* Signed-in workspace. Public pages and login retain their existing theme. */
body:has(.workspace-shell) {
  color-scheme: dark;
  --color-primary: #f4f5f7;
  --color-secondary: #a4abba;
  --color-background: #101216;
  --color-surface: #191c22;
  --color-surface-raised: #242831;
  --color-accent: #c3f078;
  --color-accent-dark: #a8d55e;
  --color-accent-muted: #293520;
  --color-text-main: #f4f5f7;
  --color-text-muted: #a4abba;
  --color-text-on-accent: #17200e;
  --color-border: #30343e;
  --color-border-strong: #5e6675;
  --color-danger: #ff9298;
  --color-danger-muted: #3a2028;
  --color-success: #c3f078;
  --bar-bg: #191c22;
  --border: 1px solid #30343e;
  --content-max-width: 860px;
  --color-bubble-sent-bg: #c3f078;
  --color-bubble-sent-text: #17200e;
  --color-bubble-recv-bg: #242831;
  --color-bubble-recv-text: #f4f5f7;
  --color-avatar-me-bg: #293520;
  --color-avatar-me-text: #c3f078;
  --color-avatar-them-bg: #30304a;
  --color-avatar-them-text: #d1c5ff;
  --color-msg-time: #a4abba;
  background: var(--color-background);
}

.workspace-shell {
  display: grid;
  grid-template-columns: 236px minmax(0,1fr);
  height: 100dvh;
}

.workspace-shell :is(button,input,textarea,select) {
  font: inherit;
}

.workspace-shell :is(button,a,input,textarea,select):focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 4px;
}

.workspace-shell button {
  cursor: pointer;
}

.workspace-shell button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.workspace-shell a {
  color: inherit;
}

.workspace-shell [x-cloak] {
  display: none !important;
}

.workspace-shell #app-content {
  min-width: 0;
  min-height: 0;
  height: 100dvh;
  overflow: hidden;
}

.workspace-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 36px 20px 24px;
  background: #15171c;
  border-right: var(--border);
}

.workspace-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -2px;
  padding: 0 12px 48px;
}

.brand-symbol {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--color-accent);
  border-radius: 50%;
  font-size: 28px;
  color: var(--color-accent);
  line-height: 1;
}

.brand-dot {
  color: var(--color-accent);
  margin-left: -10px;
}

.nav-caption {
  padding: 0 14px 12px;
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--color-text-muted);
  font-weight: 700;
}

.workspace-nav .nav-btn {
  flex-direction: row;
  justify-content: flex-start;
  gap: 14px;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 10px;
  text-decoration: none;
  color: #a4abba;
}

.workspace-nav .nav-btn span {
  margin: 0;
  text-transform: none;
  color: inherit;
  font-size: 15px;
}

.workspace-nav .nav-btn .icon {
  width: 20px;
  height: 20px;
}

.workspace-nav .nav-btn:hover {
  background: #242831;
  color: #fff;
}

.workspace-nav .nav-btn[aria-current="page"] {
  background: #293520;
  color: #c3f078;
}

.nav-note {
  margin-top: auto;
  border-top: var(--border);
  padding: 24px 12px 0;
  font-size: 16px;
}

.nav-note span {
  display: inline-block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.workspace-shell :is(.chat-header,.chat-new-header,.conversation-header) {
  flex-shrink: 0;
  min-height: 110px;
  padding: 28px 40px;
  margin: 0;
  border-bottom: var(--border);
  gap: 16px;
  background: #101216;
}

.workspace-shell .chat-header-left {
  flex: 1;
  align-items: center;
  min-width: 0;
}

.workspace-shell h1 {
  font-size: clamp(24px,3vw,34px);
  letter-spacing: -.04em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.page-eyebrow {
  color: var(--color-text-muted);
  font-size: 10px;
  letter-spacing: .18em;
  font-weight: 700;
  margin-bottom: 8px;
}

.workspace-shell .chat-list-count {
  margin-left: 8px;
  border: var(--border);
  font-size: 12px;
}

.workspace-shell :is(.chat-btn,.workspace-primary,.btn-submit,.add-btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: auto;
  min-height: 44px;
  height: auto;
  padding: 12px 18px;
  border-radius: 10px;
  border: 0;
  background: var(--color-accent);
  color: #17200e;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.workspace-shell :is(.chat-btn,.workspace-primary,.btn-submit,.add-btn):hover {
  background: var(--color-accent-dark);
}

.workspace-shell .back-btn {
  min-width: 44px;
  min-height: 44px;
  border: var(--border);
  border-radius: 10px;
}

.workspace-shell .chat-header > .back-btn {
  order: -1;
}

.workspace-shell :is(.chat-container,.chat-list-container,.main-content,.app-container) {
  height: auto;
  min-height: 0;
  flex: 1;
  padding: 32px 40px;
  overflow-y: auto;
}

.workspace-empty {
  max-width: 490px;
  margin: clamp(32px,12vh,140px) auto;
  text-align: center;
}

.empty-symbol {
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  margin: 0 auto 28px;
  border: 1px solid #425237;
  border-radius: 24px;
  color: #c3f078;
  background: #202a1c;
  font-size: 38px;
}

.workspace-empty h2 {
  font-size: clamp(26px,3vw,36px);
  letter-spacing: -.035em;
  margin-bottom: 12px;
}

.workspace-empty > p:not(.page-eyebrow) {
  color: var(--color-text-muted);
  line-height: 1.7;
  max-width: 360px;
  margin: 0 auto 28px;
}

.workspace-shell .chat-list-item {
  margin: 0 0 12px;
  padding: 22px;
  gap: 18px;
  background: var(--color-surface);
  border: var(--border);
  border-radius: 14px;
  text-decoration: none;
}

.workspace-shell .chat-list-item:hover {
  background: var(--color-surface-raised);
  border-color: #596449;
}

.workspace-shell .chat-list-item-avatar {
  width: 52px;
  height: 52px;
  border-radius: 18px;
}

.workspace-shell .chat-list-item-name {
  font-size: 17px;
}

.workspace-shell .chat-list-item-preview {
  font-size: 14px;
  margin-top: 4px;
}

.workspace-shell .chat-list-item-chevron {
  opacity: 1;
}

.workspace-shell .chat-new .user-item-btn {
  padding: 20px;
  border-radius: 14px;
}

.workspace-shell .album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill,minmax(min(100%,250px),1fr));
  gap: 24px;
  list-style: none;
}

.workspace-shell .album-card {
  padding: 0;
  overflow: hidden;
  background: var(--color-surface);
  border: var(--border);
  border-radius: 18px;
  box-shadow: none;
}

.workspace-shell .album-card:hover {
  transform: translateY(-3px);
  border-color: #667353;
}

.album-cover {
  height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: #c3f078;
  background: radial-gradient(ellipse at top right,#39482d,transparent 75%),#212920;
}

.album-card:nth-child(3n+2) .album-cover {
  color: #c6bbef;
  background: radial-gradient(ellipse at top right,#48425d,transparent 75%),#252330;
}

.album-card:nth-child(3n+3) .album-cover {
  color: #f0cba0;
  background: radial-gradient(ellipse at top right,#564631,transparent 75%),#30291f;
}

.album-cover span {
  font-size: 9px;
  letter-spacing: .22em;
}

.workspace-shell .album-title {
  margin: 20px 20px 12px;
  font-size: 20px;
  color: var(--color-text-main);
  overflow-wrap: anywhere;
}

.workspace-shell .album-card-link {
  display: block;
  height: 100%;
  padding-bottom: 20px;
  text-decoration: none;
  border-radius: inherit;
}

.workspace-shell .album-card-link:focus-visible {
  outline-offset: -3px;
}

.workspace-shell .album-card:focus-within {
  border-color: var(--color-accent);
}

.workspace-shell .chat-menu {
  padding: 0;
  max-width: 760px;
  height: auto;
  margin: 0;
}

.workspace-shell .chat-menu-profile {
  flex-direction: row;
  padding: 28px;
  gap: 20px;
}

.workspace-shell .chat-menu-name {
  font-size: 23px;
}

.workspace-shell .chat-menu-btn {
  padding: 20px 24px;
  gap: 16px;
}

.workspace-shell .chat-menu-actions-bottom {
  margin-top: 20px;
}

.workspace-shell .chat-menu-btn-danger {
  color: var(--color-danger);
}

.workspace-shell :is(.edit-layout,.profile-fields,.collaborators-container) {
  max-width: 720px;
  width: 100%;
  padding: 28px;
  background: var(--color-surface);
  border: var(--border);
  border-radius: 16px;
  box-shadow: none;
  margin: 0 0 24px;
}

.workspace-shell .profile-fields p {
  padding: 12px 0;
  border-bottom: var(--border);
  overflow-wrap: anywhere;
}

.workspace-shell :is(.form-label,.name,.collaborators-table caption) {
  color: var(--color-text-main);
}

.workspace-shell :is(.form-input,.email-input,select) {
  background: #101216;
  color: var(--color-text-main);
  border: var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 0;
}

.workspace-shell :is(.form-input,.email-input):focus {
  background: #101216;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px #c3f07820;
}

.workspace-shell .btn-submit {
  width: 100%;
}

.workspace-shell :is(.collaborators-table,.collaborator-item) {
  border-color: var(--color-border);
}

.workspace-shell .danger-btn {
  padding: 12px 18px;
  border: 1px solid #66404a;
  background: var(--color-danger-muted);
  color: var(--color-danger);
  border-radius: 10px;
}

.workspace-shell .conversation-header-name {
  font-size: 18px;
}

.workspace-shell .conversation-chat-messages {
  min-height: 0;
  padding: 28px 40px;
  gap: 20px;
}

.workspace-shell .bubble {
  max-width: 100%;
  padding: 14px 18px;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.workspace-shell .msg-row > div:not(.conversation-avatar) {
  max-width: min(76%,640px);
  min-width: 0;
}

.workspace-shell .bubble.received {
  color: var(--color-bubble-recv-text);
}

.workspace-shell .chat-input-bar {
  position: static;
  flex-shrink: 0;
  width: 100%;
  padding: 20px 40px;
  background: #101216;
  z-index: auto;
}

.workspace-shell .input-area {
  background: var(--color-surface);
  border-radius: 14px;
  padding: 14px 18px;
}

.workspace-shell .album-media-grid {
  grid-template-columns: repeat(auto-fill,minmax(min(100%,180px),1fr));
  gap: 16px;
}

.workspace-shell :is(.album-media-item,.media-thumb) {
  border-radius: 14px;
  overflow: hidden;
}

.workspace-shell :is(.media-footer,.album-media-footer) {
  position: sticky;
  bottom: 0;
  background: #191c22;
  border: var(--border);
  border-radius: 14px;
  margin-top: 20px;
  padding: 16px;
}

.workspace-shell :is(.action-group,.album-action-group) {
  flex-wrap: wrap;
  gap: 10px;
}

.workspace-shell .modern-dialog {
  color: var(--color-text-main);
  background: var(--color-surface);
  border: var(--border);
}

.workspace-shell .radio-option {
  color: var(--color-text-main);
  background: var(--color-background);
  border-color: var(--color-border);
}

/* Keep editing and conversation controls within a comfortable reading width. */
.workspace-shell .album-form {
  width: 100%;
  max-width: 720px;
  padding: 28px;
  border: var(--border);
  border-radius: 16px;
  background: var(--color-surface);
}

.workspace-shell .form-input::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

.workspace-shell .chat-container:has(> .conversation-wrap) {
  padding: 0;
  overflow: hidden;
}

.workspace-shell .conversation-wrap {
  min-height: 0;
  padding: 0;
  border-radius: 0;
}

.workspace-shell .modern-dialog legend, .workspace-shell .radio-option span {
  color: var(--color-text-main);
}

.workspace-shell .radio-option:hover {
  background: var(--color-surface-raised);
}

.workspace-shell .radio-option:has(input:checked) {
  background: var(--color-accent-muted);
  border-color: var(--color-accent);
}

.workspace-shell .radio-option:has(input:checked) span {
  color: var(--color-accent);
}

.workspace-shell .radio-option input {
  accent-color: var(--color-accent);
}

.workspace-shell :is(.btn--delete,.remove-btn) {
  background: var(--color-danger-muted);
  color: var(--color-danger);
}

.workspace-shell :is(.btn--download,.btn--move) {
  background: var(--color-surface-raised);
  color: var(--color-text-main);
  border: var(--border);
}

/* Album settings: details, access, and destructive actions have separate hierarchy. */
.workspace-shell .album-settings {
  padding-bottom: 48px;
}

.album-settings > * {
  max-width: 850px;
}

.album-settings h2 {
  font-size: 20px;
  letter-spacing: -.02em;
  margin-bottom: 8px;
}

.album-settings h3 {
  font-size: 16px;
  margin-bottom: 8px;
}

.settings-intro {
  margin-bottom: 28px;
}

.settings-intro h2 {
  font-size: 28px;
}

.settings-intro p, .settings-description, .settings-danger p {
  color: var(--color-text-muted);
  line-height: 1.6;
}

.settings-description {
  margin-bottom: 24px;
  font-size: 14px;
}

.settings-notice {
  padding: 16px 20px;
  border: var(--border);
  border-radius: 12px;
  background: var(--color-surface-raised);
  margin-bottom: 24px;
  font-size: 14px;
}

.workspace-shell .album-settings :is(.album-form,.collaborators-container) {
  max-width: 850px;
  margin-bottom: 24px;
}

.settings-form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  padding-top: 8px;
}

.workspace-shell .settings-form-actions .btn-submit {
  width: auto;
}

.settings-cancel {
  text-decoration: none;
  font-size: 14px;
  padding: 12px 0;
}

.settings-cancel:hover {
  color: var(--color-accent);
}

.workspace-shell .album-settings input[readonly] {
  color: var(--color-text-muted);
}

.settings-table-scroll {
  overflow-x: auto;
  margin: 0 0 24px;
}

.workspace-shell .album-settings .collaborators-table {
  width: 100%;
  border-collapse: collapse;
  border: 0;
  font-family: var(--font-primary);
}

.album-settings .collaborators-table :is(th,td) {
  padding: 14px 12px;
  border-bottom: var(--border);
  text-align: left;
}

.album-settings .collaborators-table th {
  color: var(--color-text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 600;
}

.album-settings .collaborators-table td {
  font-size: 14px;
}

.album-settings .collaborators-table td:last-child {
  white-space: nowrap;
}

.workspace-shell .album-settings :is(.make-god-btn,.remove-this-btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: var(--border);
  border-radius: 8px;
  background: var(--color-surface-raised);
  vertical-align: middle;
}

.album-settings :is(.make-god-btn,.remove-this-btn) img {
  width: 16px;
  height: 16px;
  filter: invert(1);
}

.album-settings #invites-container {
  border-top: var(--border);
  padding-top: 24px;
}

.album-settings .collab-form {
  max-width: none;
  font-family: inherit;
}

.album-settings .input-group-album {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 10px;
  margin-bottom: 24px;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.album-settings .input-group-album:focus-within {
  border: 0;
  box-shadow: none;
}

.album-settings .input-group-album .email-input {
  width: 100%;
}

.album-settings .input-group-album .form-label {
  grid-column: 1 / -1;
}

.album-settings .input-group-album .error-message {
  grid-column: 1 / -1;
  grid-row: 3;
}

.workspace-shell .album-settings .add-btn-album {
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  border: 0;
  border-radius: 10px;
  padding: 12px 16px;
  font-weight: 700;
}

.album-settings .invitees-list {
  list-style: none;
  padding: 0;
}

.album-settings .collaborator-item {
  padding: 12px 0;
  gap: 16px;
}

.album-settings .collaborator-item .name {
  overflow-wrap: anywhere;
  min-width: 0;
}

.album-settings .invitation-heading {
  display: flex;
  align-items: center;
  gap: 8px;
}

.settings-danger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid #57313b;
  border-radius: 16px;
  padding: 24px 28px;
}

.settings-danger h2 {
  color: var(--color-danger);
  font-size: 17px;
}

.settings-danger p {
  font-size: 14px;
}

.settings-danger button {
  flex-shrink: 0;
}

.album-settings .visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 760px) {
  .workspace-shell {
    display: flex;
    flex-direction: column-reverse;
  }

  .workspace-shell #app-content {
    height: auto;
    flex: 1;
    min-height: 0;
  }

  .workspace-nav {
    flex-direction: row;
    justify-content: space-around;
    flex-shrink: 0;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: var(--border);
    gap: 6px;
  }

  .workspace-nav :is(.workspace-brand,.nav-caption,.nav-note) {
    display: none;
  }

  .workspace-nav .nav-btn {
    flex: 1;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
    min-height: 56px;
  }

  .workspace-nav .nav-btn span {
    font-size: 11px;
  }

  .workspace-shell :is(.chat-header,.chat-new-header,.conversation-header) {
    min-height: 88px;
    padding: 20px;
    gap: 10px;
    flex-wrap: wrap;
  }

  .workspace-shell .chat-header-left {
    min-width: 130px;
  }

  .workspace-shell :is(.chat-btn,.workspace-primary) {
    padding: 12px;
    font-size: 12px;
  }

  .workspace-shell :is(.chat-container,.chat-list-container,.main-content,.app-container) {
    padding: 20px;
  }

  .workspace-shell .chat-list-item {
    padding: 16px;
    gap: 12px;
  }

  .workspace-shell .chat-input-bar {
    padding: 12px 16px;
  }

  .workspace-shell .conversation-chat-messages {
    padding: 20px 16px;
  }

  .workspace-shell .chat-header h1 {
    font-size: 25px;
  }

  .workspace-empty {
    margin: 40px auto;
  }

  .workspace-shell :is(.edit-layout,.profile-fields,.collaborators-container) {
    padding: 20px;
  }

  .workspace-shell .input-group {
    flex-wrap: wrap;
  }

  .workspace-shell .album-form {
    padding: 20px;
  }

  .settings-danger {
    align-items: flex-start;
    flex-direction: column;
    padding: 20px;
  }

  .album-settings .input-group-album {
    grid-template-columns: minmax(0,1fr);
  }

  .album-settings .input-group-album .error-message {
    grid-row: auto;
  }

  .settings-form-actions {
    flex-wrap: wrap;
    gap: 12px;
  }


}

@media (prefers-reduced-motion: reduce) {
  .workspace-shell *, .workspace-shell *::before, .workspace-shell *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .workspace-shell .chat-list-item {
    opacity: 1;
  }


}
