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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #fff;
  color: #1d1d1f;
  min-height: 100vh;
}

/* --- Login --- */

.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f2f2f7;
}

.login-card {
  background: #fff;
  border-radius: 18px;
  padding: 2.5rem 2rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.login-card h1 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.login-sub {
  color: #8e8e93;
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.login-card input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid #e5e5ea;
  border-radius: 10px;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s;
}

.login-card input:focus {
  border-color: #4f6ef7;
}

.login-card button {
  width: 100%;
  padding: 0.75rem;
  background: #4f6ef7;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.login-card button:hover {
  background: #3d5bd9;
}

/* --- Top nav --- */

.admin-topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 2rem;
  background: #fff;
  border-bottom: 1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 100;
}

.admin-topnav-left {
  display: flex;
  align-items: center;
}

.topnav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.topnav-logo:hover {
  opacity: 1;
}

.admin-topnav-center {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.topnav-link {
  font-size: 0.85rem;
  font-weight: 500;
  color: #8e8e93;
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  transition: all 0.12s;
}

.topnav-link:hover {
  color: #1d1d1f;
  background: #f0f0f5;
}

.topnav-link--active {
  color: #1d1d1f;
  font-weight: 600;
}

.admin-topnav-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.topnav-brand {
  font-size: 0.72rem;
  font-weight: 600;
  color: #1d1d1f;
  letter-spacing: 0.04em;
}

.topnav-avatar {
  width: 28px;
  height: 28px;
  background: #1d1d1f;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 700;
}

/* --- Admin header --- */

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 2rem;
  border-bottom: 1px solid #f0f0f5;
}

.header-left {
  display: flex;
  align-items: center;
}

.close-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: none;
  color: #8e8e93;
  font-size: 0.85rem;
  font-family: inherit;
  cursor: pointer;
}

.close-btn:hover {
  color: #1d1d1f;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.avatar {
  width: 32px;
  height: 32px;
  background: #1d1d1f;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* --- Admin content --- */

.admin-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
}

.brand-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #8e8e93;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}

.page-title {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

.storage-info {
  font-size: 0.85rem;
  color: #8e8e93;
  margin-bottom: 1.75rem;
}

/* --- Tabs --- */

.tabs {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid #e5e5ea;
  margin-bottom: 1.25rem;
}

.tab {
  padding: 0.65rem 1.25rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  color: #8e8e93;
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
}

.tab:hover {
  color: #1d1d1f;
}

.tab.active {
  color: #1d1d1f;
  font-weight: 600;
  border-bottom-color: #1d1d1f;
}

.tabs-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sort-label {
  font-size: 0.8rem;
  color: #8e8e93;
}

.sort-label strong {
  color: #1d1d1f;
  text-decoration: underline;
}

/* --- Search --- */

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  border: 1.5px solid #e5e5ea;
  border-radius: 10px;
  margin-bottom: 1.75rem;
  transition: border-color 0.15s;
}

.search-bar:focus-within {
  border-color: #4f6ef7;
}

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.9rem;
  font-family: inherit;
  color: #1d1d1f;
  background: none;
}

.search-bar input::placeholder {
  color: #c7c7cc;
}

/* --- File list --- */

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.month-group {
  margin-bottom: 0.5rem;
}

.month-label {
  font-size: 0.85rem;
  font-weight: 400;
  color: #8e8e93;
  padding: 0.75rem 0 0.5rem;
}

.file-card {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  border: 1px solid #e5e5ea;
  border-radius: 14px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s;
}

.file-card:hover {
  background: #fafafa;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.file-card-body {
  flex: 1;
  min-width: 0;
}

.file-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1d1d1f;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.2rem;
}

.file-card-meta {
  font-size: 0.8rem;
  color: #8e8e93;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.file-card-meta .dot {
  color: #c7c7cc;
}

.file-card-meta .status-downloaded {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.file-card-meta .status-downloaded svg {
  flex-shrink: 0;
}

.file-card-chevron {
  margin-left: 1rem;
  flex-shrink: 0;
  color: #c7c7cc;
}

/* --- File detail panel --- */

.file-detail {
  border: 1px solid #e5e5ea;
  border-radius: 14px;
  margin-bottom: 0.5rem;
  overflow: hidden;
}

.file-detail .file-card {
  border: none;
  border-radius: 0;
  margin-bottom: 0;
  border-bottom: 1px solid #f0f0f5;
}

.file-detail-body {
  padding: 1rem 1.25rem;
  background: #fafafa;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  font-size: 0.82rem;
}

.detail-label {
  color: #8e8e93;
}

.detail-value {
  color: #1d1d1f;
  font-weight: 500;
  text-align: right;
  max-width: 60%;
  word-break: break-all;
}

.detail-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e8e8ed;
}

.detail-actions button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.btn-copy-link {
  background: #f0f0f5;
  color: #1d1d1f;
}

.btn-copy-link:hover {
  background: #e5e5ea;
}

.btn-pin {
  background: #f0f0f5;
  color: #1d1d1f;
}

.btn-pin:hover {
  background: #e5e5ea;
}

.btn-pin.pinned {
  background: #4f6ef7;
  color: #fff;
}

.btn-delete {
  background: none;
  color: #ff3b30;
  margin-left: auto;
}

.btn-delete:hover {
  background: #fff0f0;
}

/* --- Empty state --- */

.empty {
  text-align: center;
  color: #c7c7cc;
  padding: 3rem 0;
  font-size: 0.9rem;
}

/* --- Utilities --- */

.error {
  color: #ff3b30;
  font-size: 0.82rem;
  margin-top: 0.5rem;
}

.hidden {
  display: none !important;
}

/* --- Responsive --- */

@media (max-width: 640px) {
  .admin-header {
    padding: 0.75rem 1rem;
  }

  .admin-content {
    padding: 1.5rem 1rem 3rem;
  }

  .page-title {
    font-size: 1.6rem;
  }

  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tabs-right {
    display: none;
  }

  .file-card {
    padding: 0.85rem 1rem;
  }
}
