body {
  font-family: Arial;
  min-height: 100vh;
  background-color: #eff8fe;
  color: white;
  text-align: center;
  margin: 0;
  display: flex;
  flex-direction: column;
}

body.modal-open {
  position: fixed;
  width: 100%;
  overflow: hidden;
}

/* GRID */
#gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  padding: 20px;
}

.card {
  position: relative;
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(135deg, #f7fbff, #e4eef8);
  border: 1px solid #cccce0;
  box-shadow: 0 4px 12px rgba(24, 24, 27, 0.14);
  min-height: 160px;
}

.card img {
  box-sizing: border-box;
  display: block;
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.25s ease;
}

.card.is-loaded img {
  opacity: 1;
}

.card:hover img {
  transform: scale(1.05);
}

.folder-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 120px;
  padding: 14px;
  border: 1px solid #cccce0;
  border-radius: 10px;
  background:
    linear-gradient(90deg, var(--folder-level-color, transparent) 0%, var(--folder-level-color, transparent) 4%, transparent 10%),
    white;
  box-shadow: 0 4px 12px rgba(24, 24, 27, 0.14);
  color: #18181b;
  text-align: left;
  text-decoration: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.folder-card:hover {
  border-color: #e50c7d;
  transform: translateY(-2px);
}

.folder-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: rgba(58, 164, 252, 0.14);
  color: #52525c;
  font-size: 16px;
  line-height: 28px;
  text-align: center;
}

.folder-card-content {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.folder-card-content strong {
  font-size: 15px;
  line-height: 1.25;
}

.folder-card-content small,
.folder-card-content span {
  overflow: hidden;
  color: #71717b;
  font-size: 12px;
  line-height: 1.3;
  text-overflow: ellipsis;
}

.photo-number {
  position: absolute;
  top: 8px;
  left: 8px;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.78);
  color: #18181b;
  font-size: 13px;
  font-weight: 600;
  line-height: 28px;
  text-align: center;
  pointer-events: none;
}

/* DOWNLOAD BUTTON */
.download-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #3aa4fc;
  border-radius: 4px;
  min-width: 86px;
  min-height: 32px;
  padding: 6px 10px;
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(24, 24, 27, 0.18);
  font-size: 13px;
  line-height: 1;

  display: flex;
  align-items: center;
  justify-content: center;

  opacity: 0;
  transition: 0.2s;
}

.card:hover .download-btn {
  opacity: 1;
}

.download-btn:hover {
  background: #238de6;
}

/* MODAL */
#modal {
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.95);

  display: none; /* 👈 important */
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

#modal.active {
  display: flex; /* 👈 show modal */
}

#modal img {
  max-width: 90%;
  max-height: 80%;
}

#close {
  position: absolute;
  top: 20px;
  right: 30px;
  font-size: 30px;
  cursor: pointer;
}

/* NAVIGATION */
.nav {
  position: absolute;
  top: 50%;
  font-size: 40px;
  cursor: pointer;
  user-select: none;
  padding: 10px;
}

#prev { left: 20px; }
#next { right: 20px; }

/* COUNTER */
#counter {
  position: absolute;
  bottom: 20px;
  font-size: 16px;
}

/* DOWNLOAD BUTTON */
#downloadBtn {
  margin-top: 10px;
  padding: 10px 15px;
  background:
    linear-gradient(90deg, var(--folder-level-color, transparent) 0%, var(--folder-level-color, transparent) 4%, transparent 10%),
    white;
  color: black;
  text-decoration: none;
}

#downloadAll {
  flex-shrink: 0;
  min-height: 34px;
  padding: 5px 10px;
  background: #3aa4fc;
  font-size: 14px;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

#downloadAll:hover {
  background: #238de6;
}

.header-link {
  flex-shrink: 0;
  min-height: 34px;
  padding: 5px 10px;
  background: #3aa4fc;
  color: white;
  font-size: 14px;
  line-height: 24px;
  text-decoration: none;
  border-radius: 4px;
  box-sizing: border-box;
  transition: background 0.2s ease;
}

.header-link:hover {
  background: #238de6;
}

.hidden {
  display: none !important;
}

.start-page {
  width: 100%;
  min-height: 100%;
  display: grid;
  place-items: center;
}

.start-page.hidden {
  display: none;
}

.album-form {
  width: 420px;
  max-width: calc(100vw - 40px);
  margin: 0 auto;
  text-align: left;
  color: #18181b;
}

.album-form label {
  display: block;
  margin-bottom: 8px;
  color: #52525c;
  font-size: 14px;
}

.album-form-row {
  display: flex;
  width: 100%;
  gap: 8px;
}

.album-form input {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 12px;
  border: 1px solid #cccce0;
  border-radius: 4px;
  color: #18181b;
  font-size: 16px;
  box-sizing: border-box;
}

.album-form button {
  box-sizing: border-box;
  min-height: 34px;
  padding: 0 14px;
  border: none;
  border-radius: 4px;
  background: #3aa4fc;
  color: white;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.album-form button:hover {
  background: #238de6;
}

.album-error {
  margin: 10px 0 0;
  color: #b42318;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
}

.login-page {
  color: #18181b;
}

.login-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  box-sizing: border-box;
}

.login-panel {
  display: grid;
  gap: 16px;
  width: min(100%, 380px);
  padding: 24px;
  border: 1px solid #cccce0;
  border-radius: 8px;
  background: white;
  box-shadow: 0 4px 16px rgba(24, 24, 27, 0.12);
  text-align: left;
  box-sizing: border-box;
}

.login-heading h1 {
  margin: 0;
  color: #18181b;
  font-size: 24px;
}

.login-heading p,
.login-panel label {
  margin: 6px 0 0;
  color: #52525c;
  font-size: 14px;
}

.login-panel label {
  display: grid;
  gap: 6px;
  margin: 0;
}

.login-panel input {
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid #cccce0;
  border-radius: 4px;
  color: #18181b;
  font-size: 14px;
  box-sizing: border-box;
}

.login-panel button {
  min-height: 34px;
  border: none;
  border-radius: 4px;
  background: #3aa4fc;
  color: white;
  font-size: 14px;
  cursor: pointer;
}

.login-panel button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.login-status {
  min-height: 18px;
  margin: 0;
  color: #52525c;
  font-size: 14px;
}

.password-hint {
  margin: -6px 0 0;
  color: #52525c;
  font-size: 13px;
  line-height: 1.35;
}

.password-hint.hidden {
  display: none;
}

.login-status.is-error {
  color: #b42318;
}

.upload-main {
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.upload-panel {
  width: 100%;
  color: #18181b;
  text-align: left;
}

.upload-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
  gap: 24px;
  align-items: start;
}

.upload-column {
  min-width: 0;
}

.upload-form {
  display: grid;
  gap: 16px;
}

.upload-folder-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}

.upload-folder-field,
.upload-file-field,
.expiration-field {
  display: grid;
  width: 100%;
  gap: 6px;
  margin: 4px 0 10px;
  min-width: 0;
}

.expiration-field {
  width: 150px;
}

.upload-form label {
  color: #52525c;
  font-size: 14px;
}

.upload-form input,
.upload-form select {
  padding: 10px;
  border: 1px solid #cccce0;
  border-radius: 4px;
  background: white;
  color: #18181b;
  font-size: 14px;
  box-sizing: border-box;
}

.upload-form input[type="file"] {
  min-height: 48px;
  padding: 10px;
  font-size: 15px;
  cursor: pointer;
}

.upload-form input[type="file"]::file-selector-button {
  min-height: 34px;
  margin-right: 12px;
  padding: 5px 12px;
  border: none;
  border-radius: 4px;
  background: #3aa4fc;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.upload-form input[type="file"]::file-selector-button:hover {
  background: #238de6;
}

.upload-folder-field label,
.upload-file-field label,
.expiration-field label {
  margin: 0;
  font-size: 13px;
}

.upload-folder-field select,
.expiration-field select {
  appearance: none;
  width: 100%;
  min-height: 34px;
  padding: 5px 34px 5px 10px;
  border: 1px solid #3aa4fc;
  border-radius: 4px;
  background:
    linear-gradient(45deg, transparent 50%, #3aa4fc 50%) calc(100% - 16px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, #3aa4fc 50%, transparent 50%) calc(100% - 10px) 50% / 6px 6px no-repeat,
    white;
  color: #18181b;
  font-size: 14px;
  line-height: 22px;
  box-shadow: 0 0 0 3px rgba(58, 164, 252, 0.12);
  cursor: pointer;
}

.upload-folder-field select:disabled,
.expiration-field select:disabled {
  border-color: #d4d4d8;
  background:
    linear-gradient(45deg, transparent 50%, #a1a1aa 50%) calc(100% - 16px) 50% / 6px 6px no-repeat,
    linear-gradient(135deg, #a1a1aa 50%, transparent 50%) calc(100% - 10px) 50% / 6px 6px no-repeat,
    #f4f4f5;
  color: #71717b;
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}

.upload-form button {
  min-height: 34px;
  border: none;
  border-radius: 4px;
  background: #3aa4fc;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.upload-form button:hover {
  background: #238de6;
}

.upload-form button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.upload-status {
  min-height: 20px;
  margin: 12px 0 0;
  color: #52525c;
  font-size: 14px;
  text-align: center;
}

.upload-status.is-error {
  color: #b42318;
}

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

.upload-result {
  display: grid;
  gap: 6px;
  color: #18181b;
}

.upload-result img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
  border: 1px solid #cccce0;
  border-radius: 4px;
  box-sizing: border-box;
}

.upload-preview-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.upload-result span {
  display: block;
  overflow: hidden;
  color: #52525c;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-result > button:not(.upload-preview-btn) {
  height: 28px;
  min-height: 28px;
  padding: 3px 8px;
  border: none;
  border-radius: 4px;
  background: rgba(24, 24, 27, 0.72);
  color: white;
  font-size: 12px;
  line-height: 20px;
  cursor: pointer;
}

.upload-result > button:not(.upload-preview-btn):hover {
  background: rgba(24, 24, 27, 0.88);
}

.upload-result > button:not(.upload-preview-btn):disabled {
  cursor: wait;
  opacity: 0.7;
}

.manage-main {
  color: #18181b;
  text-align: left;
}

.manage-panel {
  width: 100%;
}

.manage-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(180px, 1fr) minmax(160px, 1fr) auto;
  align-items: start;
  gap: 10px;
  margin-bottom: 20px;
}

.manage-form input,
.manage-form select,
.manage-form textarea {
  height: 34px;
  padding: 0 10px;
  border: 1px solid #cccce0;
  border-radius: 4px;
  box-sizing: border-box;
  font: inherit;
  font-size: 14px;
  line-height: 24px;
}

.manage-form textarea {
  min-height: 34px;
  padding-top: 4px;
  padding-bottom: 4px;
  resize: vertical;
}

.manage-form button,
.manage-actions button,
.manage-actions a {
  height: 34px;
  min-height: 34px;
  padding: 5px 10px;
  border: none;
  border-radius: 4px;
  background: #3aa4fc;
  color: white;
  font-size: 14px;
  line-height: 24px;
  text-decoration: none;
  box-sizing: border-box;
  cursor: pointer;
}

.manage-actions button:disabled {
  opacity: 0.5;
  cursor: default;
}

#toggleBinBtn {
  background: #52525c;
}

.danger-action {
  border: 1px solid rgba(190, 18, 60, 0.28) !important;
  background: rgba(254, 242, 242, 0.96) !important;
  color: #be123c !important;
}

.danger-action:hover:not(:disabled) {
  background: rgba(254, 226, 226, 0.96) !important;
  color: #9f1239 !important;
}

.manage-actions a.is-disabled {
  opacity: 0.5;
  pointer-events: none;
  cursor: default;
}

.manage-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.1fr);
  gap: 20px;
  align-items: start;
}

@media (min-width: 769px) {
  .files-column {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    overflow: auto;
  }
}

.manage-list {
  display: grid;
  gap: 10px;
}

.manage-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cccce0;
  border-radius: 4px;
  background: white;
}

.manage-item span {
  display: block;
  margin-top: 4px;
  color: #52525c;
  font-size: 13px;
}

.manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preferred-period-select {
  width: min(220px, 44vw);
  height: 34px;
  min-height: 34px;
  padding: 5px 28px 5px 10px;
  border: 1px solid #cccce0;
  border-radius: 4px;
  background: white;
  color: #18181b;
  font: inherit;
  font-size: 14px;
  line-height: 24px;
  box-sizing: border-box;
}

.folder-tree {
  display: grid;
  gap: 8px;
}

.folder-node {
  display: grid;
  gap: 8px;
}

.folder-node-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "info meta"
    "info actions";
  gap: 10px;
  align-items: start;
  padding: 10px;
  padding-left: 6px;
  border: 1px solid #cccce0;
  border-radius: 4px;
  background:
    linear-gradient(90deg, var(--folder-level-color, transparent) 0%, var(--folder-level-color, transparent) 4%, transparent 10%),
    white;
  cursor: pointer;
}

.folder-node-content.is-selected {
  border-color: #e50c7d;
  box-shadow: 0 0 0 2px rgba(229, 12, 125, 0.12);
}

.folder-node-content.is-deleted {
  border-color: #d4d4d8;
  background:
    linear-gradient(90deg, rgba(113, 113, 123, 0.12) 0%, rgba(113, 113, 123, 0.12) 4%, transparent 10%),
    #f4f4f5;
  cursor: pointer;
}

.folder-node-content.is-deleted .folder-info {
  cursor: pointer;
}

.folder-node-content.is-deleted .folder-icon {
  background: #e4e4e7;
  color: #71717b;
}

.folder-info {
  grid-area: info;
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #18181b;
  text-align: left;
  cursor: pointer;
}

.folder-info strong {
  line-height: 1.25;
}

.folder-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.folder-branch {
  width: 18px;
  margin-left: var(--folder-branch-offset, 0);
  color: #9f9fa9;
  font-size: 14px;
  line-height: 1;
  text-align: center;
  flex-shrink: 0;
}

.folder-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: rgba(58, 164, 252, 0.14);
  color: #52525c;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  flex-shrink: 0;
}

.folder-icon.is-toggle {
  cursor: pointer;
}

.folder-icon.is-toggle:hover {
  background: rgba(58, 164, 252, 0.24);
}

.folder-info small {
  overflow: hidden;
  color: #71717b;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.folder-meta {
  grid-area: meta;
  align-self: start;
  color: #52525c;
  font-size: 12px;
  line-height: 1.25;
  white-space: nowrap;
}

.folder-pending.is-active {
  display: inline-block;
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(249, 115, 22, 0.14);
  color: #52525c;
  font-size: 12px;
  font-weight: 600;
}

.folder-description {
  display: block;
  margin-left: var(--folder-description-offset, 24px);
  font-size: 11px;
}

.folder-node-content .manage-actions {
  grid-area: actions;
  align-self: end;
  justify-content: flex-end;
}

.folder-node-content .manage-actions button,
.folder-node-content .manage-actions a {
  height: 24px;
  min-height: 24px;
  padding: 2px 6px;
  font-size: 11px;
  line-height: 18px;
}

.folder-children {
  display: grid;
  gap: 8px;
}

.files-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  min-height: 44px;
}

.files-panel-header h3 {
  margin: 0;
}

.files-title-block {
  flex: 1 1 auto;
  min-width: 0;
}

.files-title-block > span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: #52525c;
  font-size: 13px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.breadcrumb-link {
  padding: 0;
  border: none;
  background: transparent;
  color: #238de6;
  font: inherit;
  font-size: 13px;
  line-height: 1.25;
  cursor: pointer;
}

.breadcrumb-link:hover {
  color: #e50c7d;
  text-decoration: underline;
}

.breadcrumb-current,
.breadcrumb-separator {
  display: inline;
  color: #52525c;
  font-size: 13px;
  line-height: 1.25;
}

.breadcrumb-separator {
  margin: 0 6px;
}

.files-panel-header .manage-actions {
  flex: 0 0 auto;
  flex-wrap: nowrap;
}

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

.manage-file-card {
  min-height: 170px;
}

.manage-file-card a {
  display: block;
}

.manage-file-card img {
  height: 170px;
  opacity: 1;
  cursor: pointer;
}

.file-status {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(24, 24, 27, 0.72);
  color: white;
  font-size: 12px;
  line-height: 1;
  text-transform: capitalize;
}

.file-status-approved {
  background: rgba(35, 141, 230, 0.88);
}

.manage-file-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  gap: 6px;
}

.manage-file-actions button {
  min-height: 30px;
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  background: rgba(24, 24, 27, 0.72);
  color: white;
  font-size: 12px;
  cursor: pointer;
}

.manage-file-actions button:disabled {
  opacity: 0.5;
  cursor: default;
}

.empty-state {
  margin: 0;
  padding: 12px;
  border: 1px dashed #cccce0;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.58);
  color: #52525c;
}

.folder-overview-list {
  display: block;
}

.folder-overview {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #cccce0;
  border-radius: 4px;
  background: white;
}

.folder-overview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.folder-overview-header strong,
.folder-overview-header span {
  display: block;
}

.folder-overview-header span {
  margin-top: 4px;
  color: #52525c;
  font-size: 13px;
}

.folder-overview-header button {
  min-height: 34px;
  padding: 5px 10px;
  border: none;
  border-radius: 4px;
  background: #3aa4fc;
  color: white;
  font-size: 14px;
  cursor: pointer;
}

.folder-overview-header button:disabled {
  opacity: 0.5;
  cursor: default;
}

.folder-overview-items {
  display: grid;
  gap: 8px;
}

.folder-overview-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #ececf6;
  border-radius: 4px;
}

.folder-overview-info {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: #18181b;
  text-align: left;
  cursor: pointer;
}

.folder-overview-info span {
  overflow: hidden;
  color: #71717b;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
}

.folder-overview-pending {
  padding: 3px 6px;
  border-radius: 4px;
  background: rgba(249, 115, 22, 0.14);
  color: #52525c;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
}

.manage-modal-actions button {
  height: 34px;
  padding: 5px 10px;
  border: none;
  border-radius: 4px;
  background: #3aa4fc;
  color: white;
  font-size: 14px;
  line-height: 1;
  box-sizing: border-box;
  cursor: pointer;
}

.manage-modal-actions button:hover:not(:disabled) {
  background: #238de6;
}

.manage-modal-actions button:disabled {
  opacity: 0.55;
  cursor: default;
}

.edit-folder-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(24, 24, 27, 0.48);
  box-sizing: border-box;
}

.edit-folder-dialog {
  display: grid;
  gap: 14px;
  width: 420px;
  max-width: 100%;
  padding: 18px;
  border-radius: 6px;
  background: white;
  color: #18181b;
  box-shadow: 0 18px 40px rgba(24, 24, 27, 0.22);
  box-sizing: border-box;
  text-align: left;
}

.edit-folder-dialog h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.edit-folder-dialog label {
  display: grid;
  gap: 6px;
  color: #52525c;
  font-size: 13px;
}

.edit-folder-dialog input,
.edit-folder-dialog select,
.edit-folder-dialog textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #cccce0;
  border-radius: 4px;
  color: #18181b;
  font: inherit;
  box-sizing: border-box;
}

.edit-folder-dialog textarea {
  resize: vertical;
}

.edit-folder-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.edit-folder-actions button {
  min-height: 34px;
  padding: 5px 12px;
  border: none;
  border-radius: 4px;
  background: #3aa4fc;
  color: white;
  font-size: 14px;
  cursor: pointer;
}

.edit-folder-actions button:first-child {
  background: rgba(24, 24, 27, 0.72);
}

.import-mode-options {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid #cccce0;
  border-radius: 4px;
}

.import-mode-options legend {
  padding: 0 4px;
  color: #52525c;
  font-size: 13px;
}

.import-mode-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #18181b;
}

.import-mode-options input {
  width: auto;
}

.import-status {
  min-height: 18px;
  margin: 0;
  color: #52525c;
  font-size: 13px;
  line-height: 1.35;
}

.import-status.is-error {
  color: #be123c;
}

.export-options {
  display: grid;
  gap: 10px;
}

.excel-export-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 34px 0 0;
  padding: 2px;
  border: 1px solid #cccce0;
  border-radius: 4px;
  background: #f4f4f7;
}

.excel-export-mode label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  color: #52525c;
  font-size: 14px;
  cursor: pointer;
}

.excel-export-mode input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.excel-export-mode span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 30px;
  border-radius: 3px;
}

.excel-export-mode input:checked + span {
  background: white;
  color: #18181b;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

.export-options button {
  min-height: 34px;
  padding: 5px 12px;
  border: none;
  border-radius: 4px;
  background: #3aa4fc;
  color: white;
  font-size: 14px;
  cursor: pointer;
}

.export-options button:hover {
  background: #238de6;
}

.import-summary-title,
.import-summary-line {
  display: block;
}

.import-summary-line {
  margin-top: 4px;
}

.import-summary-line strong {
  color: #18181b;
}

.import-count-added {
  color: #15803d;
  font-weight: 700;
}

.import-count-updated {
  color: #c2410c;
  font-weight: 700;
}

.import-count-skipped {
  color: #71717b;
}

/* GLOBAL */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* HEADER
.header {
  position: sticky;
  top: 0;
  z-index: 100;
}
*/
.header {
  box-shadow: 0 2px 5px rgba(255,255,255,0.3);
}

.header {
  background: linear-gradient(90deg, #d0eafe, #d0eaff);
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;
  gap: 20px;
}

.logo {
  font-size: 36px;
  font-weight: medium;
  color: #3aa4fc;
  width: 100%;
}

.nav a {
  margin-left: 20px;
  color: white;
  text-decoration: none;
  opacity: 0.8;
}

.nav a:hover {
  opacity: 1;
}

/* PAGE HEADER (under top nav) */
.page-header {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.page-header h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 400;
  color: #18181b;
}

.page-header h3 {
  margin: 6px 0 0;
  font-size: 16px;
  color: #71717b;
  font-weight: 400;
}

.photo-count {
  flex-shrink: 0;
  color: #52525c;
  font-size: 14px;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.manage-header-actions button {
  height: 34px;
  min-height: 34px;
  padding: 5px 10px;
  border: none;
  border-radius: 4px;
  background: #3aa4fc;
  color: white;
  font-size: 14px;
  line-height: 24px;
  cursor: pointer;
}

.manage-header-actions button:hover {
  background: #238de6;
}

/* MAIN */
.main {
  flex: 1;
  padding: 20px;
}

body.start-mode .main {
  display: grid;
  place-items: center;
  width: 100%;
  box-sizing: border-box;
}

body.start-mode .start-page {
  width: 100%;
  box-sizing: border-box;
  padding: 0;
}

body.start-mode .album-form {
  width: 420px;
  max-width: calc(100vw - 40px);
  margin-left: auto;
  margin-right: auto;
}

.gallery-notice {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 4px;
  padding: 14px 16px;
  border: 1px solid #e4e4e7;
  border-radius: 6px;
  background: #fff;
  color: #52525c;
  font-size: 14px;
}

.gallery-notice p {
  margin: 0;
}

.gallery-notice a {
  flex-shrink: 0;
  color: #238de6;
  font-weight: 600;
  text-decoration: none;
}

.gallery-notice a:hover {
  text-decoration: underline;
}

/* FOOTER LAYOUT */
.footer {
  background: #fff;
  margin-top: 40px;
  padding: 20px;
}

.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
}

/* LEFT SIDE (APP BUTTONS) */
.footer-apps {
  display: flex;
  gap: 15px;
}

.store-btn {
  padding: 20px 15px;
  border-radius: 6px;
  text-decoration: none;
  color: white;
  font-size: 14px;
  background: #333;
  transition: 0.2s;
}

.store-btn:hover {
  background: #444;
}

/* RIGHT SIDE (CONTACT) */
.footer-contact {
  text-align: right;
  font-size: 14px;
  color: #52525c;
}

.contact-row {
  display: flex;
  justify-content: flex-end;
  gap: 20px;
  margin-bottom: 10px;
}

.contact-item {
  display: inline-flex;      /* 🔥 головне */
  align-items: center;       /* 🔥 вертикальне вирівнювання */
  gap: 6px;                  /* відступ між іконкою і текстом */
  color: inherit;
  text-decoration: none;
}

.contact-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  transform: translateY(1px);
}

.copyright {
  color: #9f9fa9;
  font-size: 13px;
  line-height: 1.4;
}

.copyright a {
  color: #9f9fa9;
  opacity: 0.8;
}

/* MODAL FIX (from previous step) */
#modal {
  display: none;
  position: fixed;
  z-index: 1000;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.95);

  align-items: center;
  justify-content: center;
}

#modal.active {
  display: flex;
}

#modal img {
  max-width: 90%;
  max-height: calc(100% - 130px);
  z-index: 1;
  transform-origin: center;
  transition: transform 0.12s ease;
  touch-action: none;
}

.nav-arrow {
  position: absolute;
  bottom: 60px;
  width: 34px;
  height: 34px;
  padding: 0;
  background: rgba(24, 24, 27, 0.72);
  font-size: 14px;
  border-radius: 4px;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
  cursor: pointer;
  user-select: none;
  z-index: 2;
  transition: background 0.2s ease;
}

.nav-arrow:hover {
  background: rgba(24, 24, 27, 0.88);
}

#prev {
  left: 30px;
}

#next {
  right: 30px;
}

#close {
  position: absolute;
  top: 20px;
  right: 30px;
  width: 34px;
  height: 34px;
  padding: 0;
  background: rgba(24, 24, 27, 0.72);
  border-radius: 4px;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
  color: white;
  font-size: 24px;
  line-height: 34px;
  text-align: center;
  cursor: pointer;
  z-index: 3;
  transition: background 0.2s ease;
}

#close:hover {
  background: rgba(24, 24, 27, 0.88);
}

#counter {
  position: static;
  bottom: auto;
  left: auto;
  transform: none;
  color: white;
  font-size: 14px;
  height: 34px;
  padding: 5px 10px;
  min-width: 58px;
  background: rgba(24, 24, 27, 0.72);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
  white-space: nowrap;
}

.modal-actions {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: nowrap;
}

#downloadBtn {
  margin-top: 0;
  height: 34px;
  padding: 5px 10px;
  background: #3aa4fc;
  font-size: 14px;
  color: white;
  text-decoration: none;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-sizing: border-box;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.24);
}

#downloadBtn:hover {
  background: #238de6;
}

.to-top-btn {
  display: none;
}

@media (max-width: 768px) {
  .main {
    padding: 10px 8px 14px;
  }

  #gallery {
    gap: 12px;
    padding: 10px 4px;
  }

  .gallery-notice {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }

  .card {
    min-height: 190px;
  }

  .card img {
    height: 190px;
  }

  .header-inner {
    height: auto;
    min-height: 62px;
    padding-top: 8px;
    padding-bottom: 8px;
    gap: 12px;
  }

  .page-header {
    flex: 1;
    min-width: 0;
    text-align: left;
  }

  .page-header h2 {
    font-size: 17px;
    line-height: 1.2;
  }

  .page-header h3 {
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.25;
  }

  #downloadAll {
    flex-shrink: 0;
    min-height: 34px;
    padding: 6px 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .header-actions {
    flex-shrink: 0;
    flex-direction: column;
    align-items: center;
    gap: 4px;
  }

  .photo-count {
    font-size: 12px;
  }

  .footer {
    margin-top: 18px;
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .footer-top {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .footer-contact {
    text-align: center;
  }

  .contact-row {
    justify-content: center;
  }

  .to-top-btn {
    position: fixed;
    right: 16px;
    bottom: 80px;
    z-index: 30;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #3aa4fc;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(24, 24, 27, 0.24);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease, background 0.2s ease;
  }

  .to-top-btn::before {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: rgba(58, 164, 252, 0.18);
    z-index: -1;
  }

  .to-top-btn.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .to-top-btn:hover {
    background: #238de6;
  }

  .start-page {
    min-height: 100%;
  }

  .album-form-row {
    flex-direction: column;
  }

  .start-page .album-form input {
    width: 100%;
    height: 34px;
    min-height: 34px;
    line-height: 34px;
    -webkit-appearance: none;
    appearance: none;
  }

  .start-page .album-form button {
    width: 100%;
    min-height: 34px;
  }

  .manage-form,
  .manage-grid {
    grid-template-columns: 1fr;
  }

  .manage-form {
    justify-items: center;
  }

  .manage-form input,
  .manage-form select,
  .manage-form textarea,
  .manage-form button {
    width: min(100%, 340px);
  }

  .folders-column {
    order: 2;
  }

  .files-column {
    order: 1;
  }

  .folder-node-content {
    grid-template-columns: 1fr;
    grid-template-areas:
      "meta"
      "info"
      "actions";
    padding-left: 6px;
  }

  .folder-meta {
    justify-self: end;
  }

  .files-panel-header {
    align-items: flex-start;
    flex-direction: column;
    max-width: 100%;
  }

  .files-title-block,
  .files-title-block > span {
    max-width: 100%;
  }

  .manage-file-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .upload-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .upload-folder-fields {
    grid-template-columns: 1fr;
  }

  .upload-results {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
}
