:root {
  --bg: #120206;
  --panel: rgba(18, 5, 10, 0.85);
  --panel-alt: rgba(255, 255, 255, 0.02);
  --border: rgba(255, 255, 255, 0.15);
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.65);
  --accent: #d7263d;
  --accent-soft: rgba(215, 38, 61, 0.18);
  --success: #66ffb2;
  --error: #ff7b7b;
  --radius: 4px;
  --radius-sm: 2px;
  --shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
  --row-bg: rgba(255, 255, 255, 0.03);
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', 'Space Grotesk', system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 15% 20%, rgba(215, 38, 61, 0.25), transparent 55%),
    radial-gradient(circle at 80% -5%, rgba(255, 111, 72, 0.18), transparent 55%),
    var(--bg);
  padding: 64px 24px 80px;
  display: flex;
  justify-content: center;
}

input,
button,
textarea {
  font-family: inherit;
  outline: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(215, 38, 61, 0.45);
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle, rgba(215, 38, 61, 0.2), transparent 60%);
  filter: blur(90px);
}

.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 1, 3, 0.9);
  display: grid;
  place-items: center;
  z-index: 20;
  transition: opacity 0.2s ease;
}

.login-overlay[aria-hidden='true'] {
  pointer-events: none;
  opacity: 0;
}

.login-card {
  width: min(360px, 90vw);
  background: #160208;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card h2 {
  margin: 0;
}

.login-card label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-card input {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.55);
  color: var(--text);
  padding: 10px;
}

.login-subtitle {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-error {
  min-height: 18px;
  margin: 4px 0 0;
  color: var(--error);
  font-size: 0.85rem;
}

.layout {
  width: min(1100px, 100%);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.layout[aria-hidden='true'] {
  filter: blur(8px);
  pointer-events: none;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.card-head,
.files-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: var(--muted);
}

.eyebrow.small {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
}

.text-input {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.text-input span {
  font-size: 0.85rem;
  color: var(--muted);
}

.text-input input {
  border-radius: var(--radius);
  border: none;
  background: rgba(0, 0, 0, 0.45);
  padding: 12px;
  font-size: 0.95rem;
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.dropzone {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  padding: 44px 28px;
  background: radial-gradient(circle at 30% 30%, rgba(215, 38, 61, 0.35), rgba(12, 0, 5, 0.8));
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05), 0 18px 40px rgba(0, 0, 0, 0.55);
}

.dropzone:hover,
.dropzone.dragging,
.dropzone:focus-within {
  transform: translateY(-2px);
  background: radial-gradient(circle at 20% 20%, rgba(215, 38, 61, 0.5), rgba(12, 0, 5, 0.9));
  box-shadow: inset 0 0 0 1px rgba(215, 38, 61, 0.4), 0 24px 55px rgba(215, 38, 61, 0.4);
}

.dropzone-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
}

.drop-title {
  margin: 0;
  font-size: 1.1rem;
}

.drop-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.icon-cloud {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  color: var(--accent);
}

.ghost-btn {
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  padding: 8px 20px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.ghost-btn.danger {
  border-color: rgba(255, 122, 122, 0.6);
  color: #ffd7d7;
}

.ghost-btn.danger:hover {
  background: rgba(255, 122, 122, 0.15);
}

.primary-btn {
  border: none;
  border-radius: var(--radius-sm);
  background: linear-gradient(120deg, #ff6b6b, var(--accent));
  color: var(--text);
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 15px 30px rgba(215, 38, 61, 0.4);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  padding: 16px;
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.status-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  color: var(--muted);
}

.status-value {
  margin: 4px 0 0;
  font-size: 1.05rem;
}

.progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff9f80, #ff5f5f);
  transition: width 0.2s ease;
}

#progressLabel {
  font-size: 0.9rem;
  color: var(--muted);
}

#progressLabel[data-state='success'] {
  color: var(--success);
}

#progressLabel[data-state='error'] {
  color: var(--error);
}

.files {
  min-height: 480px;
}

.files-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.storage-indicator {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
}

.storage-ring {
  --storage-percent: 0;
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: conic-gradient(
    var(--accent) calc(var(--storage-percent) * 1%),
    rgba(255, 255, 255, 0.12) 0
  );
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}

.storage-ring::after {
  content: '';
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(12, 0, 3, 0.9);
}

.storage-ring span {
  position: relative;
  z-index: 1;
}

.storage-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.85rem;
}

.storage-label {
  font-weight: 600;
}

.storage-sub {
  color: var(--muted);
  font-size: 0.78rem;
}

.files-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.file-placeholder {
  padding: 32px;
  border-radius: var(--radius);
  background: var(--panel-alt);
  color: var(--muted);
  text-align: center;
}

.file-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-radius: var(--radius-sm);
  background: var(--row-bg);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.file-row:hover {
  border-color: var(--accent);
  background: rgba(215, 38, 61, 0.08);
}

.file-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-name {
  margin: 0;
  font-size: 1rem;
}

.file-mime {
  color: var(--muted);
  font-size: 0.85rem;
}

.file-owner-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 0.75rem;
  width: fit-content;
}

.file-owner-pill.is-hidden {
  display: none;
}

.file-meta {
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.file-menu-container {
  position: relative;
}

.menu-btn {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}

.menu-btn span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text);
}

.menu {
  position: absolute;
  top: 48px;
  right: 0;
  background: #1c070c;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 180px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  display: none;
  flex-direction: column;
  padding: 6px;
  z-index: 10;
}

.menu[aria-hidden='false'] {
  display: flex;
}

.menu button {
  border: none;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}

.menu button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.menu button.media-action.is-hidden {
  display: none;
}

.menu button.danger {
  color: var(--error);
}

.menu button.danger:hover {
  background: rgba(255, 123, 123, 0.15);
}

.accounts[hidden] {
  display: none;
}

.account-form {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.account-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.account-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

.account-form input,
.account-form select {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  padding: 10px;
}

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

.accounts-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.account-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.account-row-main {
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-row-name {
  margin: 0;
  font-weight: 600;
}

.account-row-role {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  text-transform: capitalize;
}

.account-row-role[data-role='admin'] {
  background: rgba(215, 38, 61, 0.2);
  color: #ffb0c0;
}

.account-row-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.82rem;
  color: var(--muted);
}

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

@media (max-width: 720px) {
  body {
    padding: 36px 16px 48px;
  }

  .topbar,
  .card {
    padding: 24px;
  }

  .file-row {
    flex-direction: column;
  }

  .file-meta {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .menu {
    right: auto;
    left: 0;
  }
}
