*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0f1117;
  color: #e2e8f0;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}
a { color: #60a5fa; text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
  padding-bottom: calc(1.25rem + env(safe-area-inset-bottom));
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #1e293b;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
}
header h1 { font-size: 1.1rem; font-weight: 600; color: #f1f5f9; }
.logout-btn {
  background: #1e293b;
  color: #94a3b8;
  border: none;
  padding: .5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: .875rem;
  min-height: 40px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.logout-btn:active { background: #334155; color: #e2e8f0; }

/* Card */
.card {
  background: #1e293b;
  border-radius: 12px;
  padding: 1.5rem;
}
@media (max-width: 480px) { .card { padding: 1.25rem 1rem; } }

/* Flash */
.flash {
  padding: .75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  background: #1e3a5f;
  border: 1px solid #2563eb;
  font-size: .9rem;
  line-height: 1.5;
}

/* Form elements */
input[type=text], input[type=email] {
  width: 100%;
  padding: .75rem 1rem;
  background: #0f1117;
  border: 1px solid #334155;
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 1rem;
  outline: none;
  -webkit-appearance: none;
  min-height: 48px;
}
input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.2); }

label { display: block; font-size: .875rem; color: #94a3b8; margin-bottom: .4rem; }
.field { margin-bottom: 1.25rem; }
.form-title { font-size: 1.4rem; font-weight: 600; margin-bottom: .4rem; }
.form-sub { color: #64748b; font-size: .9rem; margin-bottom: 1.75rem; line-height: 1.5; }
.form-footer { margin-top: 1.25rem; text-align: center; font-size: .85rem; color: #64748b; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .75rem 1.4rem;
  border: none;
  border-radius: 8px;
  min-height: 48px;
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s;
}
.btn:active { opacity: .75; }
.btn-primary { background: #2563eb; color: #fff; }
.btn-danger  { background: #dc2626; color: #fff; font-size: .8rem; min-height: 40px; padding: .5rem .9rem; }
.btn-ghost   { background: #334155; color: #e2e8f0; font-size: .8rem; min-height: 40px; padding: .5rem .9rem; text-decoration: none; }
.btn-full    { width: 100%; }

/* OTP input */
.otp-input {
  letter-spacing: .3em;
  text-transform: uppercase;
  font-size: 1.3rem;
  text-align: center;
}

/* Storage bar */
.storage-widget {
  background: #1e293b;
  border-radius: 10px;
  padding: .9rem 1.1rem;
  margin-bottom: 1.25rem;
}
.storage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: .25rem;
  margin-bottom: .4rem;
}
.storage-label { font-size: .8rem; color: #94a3b8; }
.storage-track { background: #0f1117; border-radius: 6px; height: 8px; }
.storage-bar {
  height: 8px;
  border-radius: 6px;
  background: #2563eb;
  width: 0;
  transition: width .4s;
}
.storage-bar.warn { background: #f59e0b; }
.storage-bar.crit { background: #dc2626; }

/* Upload zone */
.upload-zone {
  border: 2px dashed #334155;
  border-radius: 10px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.upload-zone:hover, .upload-zone.drag { border-color: #3b82f6; background: #0f1d35; }
.upload-zone input[type=file] { display: none; }
.upload-icon { font-size: 1.75rem; line-height: 1; }
.upload-title { font-weight: 500; margin: .4rem 0 .1rem; }
.upload-sub { font-size: .85rem; color: #64748b; margin: 0; }

/* Transfer progress */
.xfer-panel {
  display: none;
  background: #1e293b;
  border-radius: 10px;
  padding: .9rem 1rem;
  margin-top: .75rem;
}
.xfer-panel.active { display: block; }
.xfer-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: .5rem;
  font-size: .85rem;
}
.xfer-name {
  color: #e2e8f0;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 60%;
}
.xfer-pct { color: #60a5fa; font-weight: 600; font-size: .95rem; flex-shrink: 0; }
.xfer-track { background: #0f1117; border-radius: 6px; height: 8px; overflow: hidden; }
.xfer-bar {
  height: 8px;
  border-radius: 6px;
  width: 0;
  background: #2563eb;
  transition: width .2s;
}
.xfer-bar.dl { background: #059669; }
.xfer-footer {
  display: flex;
  justify-content: space-between;
  margin-top: .4rem;
  font-size: .8rem;
  color: #64748b;
}

/* File table – desktop */
.file-table { width: 100%; border-collapse: collapse; margin-top: 1.25rem; }
.file-table th {
  text-align: left;
  padding: .5rem .75rem;
  font-size: .75rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid #334155;
}
.file-table td { padding: .65rem .75rem; border-bottom: 1px solid #1e293b; font-size: .9rem; vertical-align: middle; }
.file-table tr:last-child td { border-bottom: none; }
.file-table tr:hover td { background: #1a2540; }
.file-actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; }

/* File table – mobile cards */
@media (max-width: 600px) {
  .file-table, .file-table thead, .file-table tbody,
  .file-table th, .file-table td, .file-table tr { display: block; }
  .file-table thead { display: none; }
  .file-table tr {
    background: #1e293b;
    border-radius: 10px;
    margin-bottom: .75rem;
    padding: .75rem 1rem;
    border: 1px solid #334155;
  }
  .file-table tr:hover { background: #263354; }
  .file-table td { padding: .25rem 0; border: none; font-size: .9rem; }
  .file-name { font-weight: 500; color: #60a5fa; font-size: .95rem; word-break: break-all; }
  .file-meta { color: #64748b; font-size: .8rem; margin: .15rem 0 .6rem; }
  .file-desktop { display: none; }
  .file-actions { justify-content: flex-start; }
}
@media (min-width: 601px) {
  .file-meta { display: none; }
}

/* Empty state */
.empty-state { text-align: center; color: #475569; margin-top: 3rem; font-size: .95rem; }

/* Center form wrapper */
.form-wrap { max-width: 420px; margin: 2rem auto; }

/* TOTP setup */
.totp-qr { text-align: center; margin: 1.25rem 0; }
.totp-qr img { width: 200px; height: 200px; border-radius: 8px; background: #fff; padding: 8px; }
.totp-secret-label { font-size: .8rem; color: #64748b; margin-bottom: .4rem; }
.totp-secret {
  font-family: monospace;
  font-size: .95rem;
  letter-spacing: .15em;
  background: #0f1117;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: .75rem 1rem;
  word-break: break-all;
  text-align: center;
  color: #e2e8f0;
  margin-bottom: .5rem;
}

/* Error page */
.error-page { max-width: 420px; margin: 4rem auto; text-align: center; }
.error-code { font-size: 3rem; margin-bottom: .5rem; }
.error-msg { font-size: 1.1rem; color: #94a3b8; margin-bottom: 1.5rem; }
