* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(135deg, #0f766e 0%, #134e4a 100%);
  color: #1f2937;
}

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 16px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 28px 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
}

h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.subtitle {
  margin: 0 0 24px;
  color: #6b7280;
  font-size: 14px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="file"],
.field select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: #0f766e;
}

.btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: #0f766e;
  color: #fff;
}

.btn-secondary {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
}

.btn-google {
  background: #fff;
  color: #374151;
  border: 1px solid #d1d5db;
  margin-top: 8px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
  color: #9ca3af;
  font-size: 13px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.error {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 14px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.user-label {
  font-size: 14px;
  color: #4b5563;
  word-break: break-all;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.user-menu {
  position: relative;
  display: flex;
}

.header-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 36px;
  padding: 0;
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 18px;
  height: 18px;
}

.hamburger-icon span {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
}

.logout-icon {
  width: 18px;
  height: 18px;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 100;
  min-width: 200px;
  padding: 6px 0;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
}

.account-dropdown[hidden] {
  display: none;
}

.account-dropdown-meta {
  padding: 10px 14px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 12px;
  color: #6b7280;
}

.account-display-name {
  margin-bottom: 2px;
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}

.account-email {
  overflow-wrap: anywhere;
}

.account-menu-item {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: none;
  color: #374151;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.account-menu-item:hover {
  background: #f3f4f6;
}

.result {
  margin-top: 18px;
  padding: 14px;
  border-radius: 8px;
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  font-size: 14px;
}

.progress-wrap {
  margin-top: 12px;
}

.progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.progress-header .progress-label {
  margin-top: 0;
}

.progress-wrap progress {
  display: block;
  width: 100%;
  height: 8px;
  border: none;
  border-radius: 4px;
  overflow: hidden;
  background: #e5e7eb;
}

.progress-wrap progress::-webkit-progress-bar {
  background: #e5e7eb;
  border-radius: 4px;
}

.progress-wrap progress::-webkit-progress-value {
  background: #0f766e;
  border-radius: 4px;
}

.progress-wrap progress::-moz-progress-bar {
  background: #0f766e;
  border-radius: 4px;
}

.progress-label {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  color: #6b7280;
  text-align: center;
}

.explorer {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.explorer-header {
  flex-shrink: 0;
  margin-bottom: 12px;
}

.explorer-scroll {
  max-height: min(60vh, 480px);
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 8px;
}

.btn-sm {
  width: auto;
  padding: 8px 12px;
  font-size: 13px;
}

.btn-danger {
  background: #fff;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.explorer.is-busy .folder-nav,
.explorer.is-busy .files-dropzone,
.explorer.is-busy .shares-panel {
  pointer-events: none;
  opacity: 0.65;
}

.explorer.is-busy .files-empty {
  display: none !important;
}

.folder-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.folder-nav[hidden] {
  display: none !important;
}

.folder-nav label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.folder-nav select {
  flex: 1;
  min-width: 140px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

.folder-nav select:focus {
  outline: none;
  border-color: #0f766e;
}

.folder-nav select[hidden] {
  display: none !important;
}

.folder-nav #shares-list-btn,
.folder-nav #shares-back-btn {
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
}

.shares-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.shares-panel[hidden] {
  display: none !important;
}

.shares-panel-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: #111827;
}

.shares-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.share-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fafafa;
}

.share-item.is-inactive {
  opacity: 0.72;
  background: #f3f4f6;
}

.share-item-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.share-item-name {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}

.share-item-detail {
  margin: 0;
  font-size: 12px;
  color: #6b7280;
  word-break: break-all;
}

.share-item-status {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  vertical-align: middle;
}

.share-item-status.is-active {
  background: #ecfdf5;
  color: #0f766e;
}

.share-item-status.is-expired {
  background: #fef3c7;
  color: #92400e;
}

.share-item-status.is-revoked {
  background: #fee2e2;
  color: #991b1b;
}

.share-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.share-password-gate {
  margin: 24px auto 8px;
  max-width: 360px;
  width: 100%;
}

.share-password-gate .field {
  margin-bottom: 12px;
}

.share-password-gate .btn {
  width: 100%;
}

.files-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.files-toolbar[hidden] {
  display: none !important;
}

.files-toolbar-left,
.files-toolbar-right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.files-selection-label {
  margin: 0 0 10px;
  font-size: 13px;
  color: #0f766e;
  font-weight: 600;
}

.move-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: #f0fdfa;
}

.move-bar[hidden] {
  display: none;
}

.move-bar label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.move-bar select {
  flex: 1;
  min-width: 140px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

.move-bar select:focus {
  outline: none;
  border-color: #0f766e;
}

.files-dropzone {
  flex: 1;
  min-height: 160px;
  border: 2px dashed transparent;
  border-radius: 10px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.files-dropzone[hidden] {
  display: none !important;
}

.files-dropzone.files-dropzone-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  border-color: #d1d5db;
}

.files-dropzone.files-dropzone-empty .explorer-scroll {
  display: none;
}

.files-dropzone.files-dropzone-active {
  border-color: #0f766e;
  background: #f0fdfa;
}

.files-empty {
  padding: 24px 12px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

.files-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fafafa;
}

.file-item.is-folder {
  cursor: pointer;
}

.file-item.is-folder:hover {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.file-item.is-openable {
  cursor: pointer;
}

.file-item.is-openable:hover {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.file-item-check {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.file-item-thumb,
.file-item-icon {
  width: 72px;
  height: 72px;
  border-radius: 8px;
  background: #e5e7eb;
  flex-shrink: 0;
}

.file-item-thumb {
  object-fit: cover;
}

.file-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #0f766e;
  background: #ecfdf5;
}

.file-item-icon-folder {
  font-size: 0;
}

.file-item-icon-folder svg {
  display: block;
  color: #0f766e;
}

.file-item-body {
  flex: 1;
  min-width: 0;
}

.file-item-name {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}

.file-item-meta {
  margin: 0;
  font-size: 12px;
  color: #6b7280;
}

.file-item-action,
.file-item-stats {
  flex-shrink: 0;
  margin-left: auto;
}

.file-item-stats {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.45);
}

.modal[hidden] {
  display: none;
}

.modal-dialog {
  width: min(420px, 100%);
  padding: 20px 22px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
}

.modal-dialog h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.modal-message {
  margin: 0 0 14px;
  font-size: 14px;
  color: #374151;
  white-space: pre-line;
  line-height: 1.5;
}

.retry-kinds {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.retry-kind-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  color: #111827;
  cursor: pointer;
}

.retry-kind-row input {
  margin-top: 2px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.modal-actions .btn {
  width: auto;
}

.profile-modal-actions {
  justify-content: space-between;
}

.profile-modal-actions-right {
  display: flex;
  gap: 8px;
}

.image-viewer-modal {
  padding: 24px;
  background: rgba(15, 23, 42, 0.88);
}

.image-viewer-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(96vw, 1200px);
  max-height: 96vh;
  gap: 12px;
}

.image-viewer-close {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 1;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.image-viewer-close:hover {
  background: #fff;
}

.image-viewer-img {
  max-width: 96vw;
  max-height: calc(96vh - 64px);
  object-fit: contain;
  border-radius: 8px;
  background: #111827;
}

.image-viewer-status {
  margin: 0;
  font-size: 14px;
  color: #e5e7eb;
}

.image-viewer-caption {
  margin: 0;
  max-width: 96vw;
  font-size: 13px;
  color: #d1d5db;
  text-align: center;
  word-break: break-all;
}

.share-header {
  margin-bottom: 16px;
}

.share-brand {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: #0f766e;
  letter-spacing: 0.02em;
}

.share-loading {
  padding: 24px 0;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

.share-file-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.share-file-actions .btn {
  width: auto;
  min-width: 72px;
  padding: 6px 10px;
}

.share-header .files-toolbar {
  margin-top: 12px;
}

.field-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: #6b7280;
}

#share-result-url {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #f9fafb;
}

#share-title-input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
}

#share-title-input:focus {
  outline: none;
  border-color: #0f766e;
}
