:root {
  --ink: #122033;
  --muted: #5b6b80;
  --line: rgba(18, 32, 51, 0.12);
  --paper: #fbf8f1;
  --card: #fffdf8;
  --accent: #1f5eff;
  --accent-dark: #1646c7;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 24px 70px rgba(12, 28, 58, 0.28);
}

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

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", "Avenir Next", system-ui, sans-serif;
  color: var(--ink);
  background: #07111f;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.auth-body {
  min-height: 100dvh;
}

.auth-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1100px 540px at 12% -10%, rgba(80, 150, 255, 0.28), transparent 60%),
    radial-gradient(900px 480px at 90% 8%, rgba(255, 186, 92, 0.18), transparent 55%),
    linear-gradient(180deg, #0b1a30 0%, #10243f 42%, #0a1628 100%);
}
.auth-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.08) 0 2px, transparent 3px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,0.06) 0 1.5px, transparent 2.5px);
  background-size: 140px 140px, 90px 90px;
  opacity: 0.45;
  pointer-events: none;
}

.auth-wrap {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.auth-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.55);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.auth-logo {
  display: block;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  background: #000;
}

.auth-kicker {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-brand h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.auth-lead {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.5;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin: 0 0 16px;
  background: #efe8d8;
  border-radius: 12px;
}

.auth-tab {
  text-align: center;
  padding: 10px 8px;
  border-radius: 9px;
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}

.auth-tab.is-active {
  background: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,0.8), 0 6px 16px rgba(18,32,51,0.08);
}

.auth-form { display: grid; gap: 12px; }

.field { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
.field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 13px;
  font: inherit;
  font-weight: 500;
  background: #fff;
  color: var(--ink);
}
.field input:focus {
  outline: 2px solid rgba(31, 94, 255, 0.28);
  border-color: var(--accent);
}

.code-input {
  letter-spacing: 0.35em;
  font-size: 22px !important;
  font-weight: 800 !important;
  text-align: center;
}

.auth-forgot, .auth-alt, .auth-hint, .auth-foot {
  color: var(--muted);
  font-size: 13px;
}

.auth-forgot { margin: -2px 0 4px; text-align: right; }
.auth-alt { margin: 14px 0 0; text-align: center; }
.auth-hint { margin: 10px 0 0; text-align: center; line-height: 1.45; }
.auth-foot { margin: 18px 0 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lang-switch {
  display: flex;
  justify-content: center;
  margin: 16px 0 0;
}

.lang-switch select {
  max-width: 100%;
  min-width: 160px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.app-user .lang-switch {
  margin: 0;
}

.app-user .lang-switch select {
  background: #152033;
  color: #fff;
  border-color: #2a3c58;
}

html[dir="rtl"] .auth-forgot { text-align: left; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 750;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(31, 94, 255, 0.28);
}
.btn-primary:hover { background: var(--accent-dark); text-decoration: none; }

.btn-google {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
.btn-google:hover { background: #f7f4ec; text-decoration: none; }
.btn-google.is-disabled { opacity: 0.78; cursor: default; pointer-events: none; }

.btn-ghost {
  width: auto;
  background: transparent;
  color: #eaf1ff;
  border-color: rgba(255,255,255,0.16);
  padding: 8px 12px;
  font-size: 13px;
}
.btn-ghost:hover { background: rgba(255,255,255,0.08); text-decoration: none; }

.google-icon { display: flex; }

.auth-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.auth-divider::before, .auth-divider::after {
  content: "";
  height: 1px;
  background: var(--line);
}

.flash {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.45;
}
.flash--error { background: #fdecea; color: var(--danger); }
.flash--success { background: #e8f6ee; color: var(--ok); }
.flash--info { background: #eef3ff; color: #1849a9; word-break: break-all; }

.app-body {
  min-height: 100dvh;
  background: #f4f1ea;
  color: var(--ink);
}

.app-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 10px 18px;
  background: #0d1b30;
  color: #f4f7fb;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  letter-spacing: -0.03em;
}

.app-logo {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  background: #000;
}

.app-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: #c9d6ea;
}

.app-blank {
  min-height: calc(100dvh - 58px);
  background: #fff;
}

.cloud-shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.cloud-hero h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.04em;
}

.cloud-hero p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.cloud-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 22px;
}

.choice-card {
  display: grid;
  gap: 6px;
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(18, 32, 51, 0.05);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.choice-card:hover {
  text-decoration: none;
  transform: translateY(-1px);
  border-color: rgba(31, 94, 255, 0.35);
}

.choice-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 12px 32px rgba(31, 94, 255, 0.12);
}

.choice-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #eef3ff;
  color: var(--accent);
  margin-bottom: 4px;
}

.choice-card strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.choice-card span {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.4;
}

.cloud-panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: #fffdf8;
  padding: 22px;
}

.cloud-panel h2 {
  margin: 0 0 8px;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.cloud-limit {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.dropzone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 36px 18px;
  border: 1.5px dashed rgba(31, 94, 255, 0.35);
  border-radius: 16px;
  background: #f4f7ff;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
}

.dropzone.is-over {
  background: #e7eeff;
  border-color: var(--accent);
}

.dropzone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.dropzone strong { font-size: 16px; }
.dropzone span { color: var(--muted); font-size: 13px; }

.upload-form {
  display: grid;
  gap: 14px;
  position: relative;
}

.upload-error {
  margin: 0;
  color: var(--danger);
  font-size: 13.5px;
  font-weight: 700;
}

.btn-inline { width: auto; justify-self: start; padding-left: 18px; padding-right: 18px; }

.empty-files {
  display: grid;
  gap: 12px;
  justify-items: start;
  color: var(--muted);
}

.file-grid {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.file-card {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.file-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #eef3ff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='0 0 24 24' fill='none' stroke='%231f5eff' stroke-width='1.8'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3C/svg%3E") center / 22px no-repeat;
}

.file-card[data-kind="image"] .file-card__icon { background-color: #fff4e5; }
.file-card[data-kind="pdf"] .file-card__icon { background-color: #fdecea; }
.file-card[data-kind="archive"] .file-card__icon { background-color: #eef6ff; }

.file-card__name {
  display: block;
  font-size: 14.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card__meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
}

.file-card__actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.file-card__actions form { margin: 0; }

.btn-tiny {
  width: auto;
  padding: 8px 10px;
  font-size: 12.5px;
  border-radius: 9px;
  background: #eef3ff;
  color: var(--accent-dark);
}

.btn-tiny:hover { background: #e0e9ff; text-decoration: none; }

.btn-danger {
  background: #fdecea;
  color: var(--danger);
}
.btn-danger:hover { background: #f9d5d2; }

@media (max-width: 720px) {
  .cloud-choices { grid-template-columns: 1fr; }
  .file-card {
    grid-template-columns: 42px 1fr;
  }
  .file-card__actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }
}

@media (max-width: 520px) {
  .auth-card { padding: 22px 18px 18px; }
  .app-user span { display: none; }
}
