:root {
  --ink: #121a22;
  --ink-soft: #4a5560;
  --fog: #e8eef3;
  --mist: #c9d4de;
  --paper: rgba(255, 255, 255, 0.88);
  --paper-solid: #f5f8fb;
  --line: rgba(18, 26, 34, 0.1);
  --accent: #176b5a;
  --accent-deep: #0f4a3e;
  --danger: #a11d1d;
  --ok: #146c43;
  --shadow: 0 18px 40px rgba(16, 28, 36, 0.1);
  --radius: 14px;
  --font-display: "Syne", sans-serif;
  --font-body: "Outfit", sans-serif;
}

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

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: #e6edf2;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 50% at 8% 0%, rgba(23, 107, 90, 0.16), transparent 55%),
    radial-gradient(ellipse 55% 40% at 100% 8%, rgba(28, 52, 72, 0.12), transparent 50%),
    linear-gradient(180deg, #f2f6f9 0%, #e5ecf1 48%, #dce5ec 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.78);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-block {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}

.brand-for {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.nav a.active,
.nav a:hover {
  color: var(--accent-deep);
}

.nav-user {
  padding: 0.28rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.86rem;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-soft);
}

.nav-logout {
  color: var(--danger) !important;
}

.shell {
  width: min(1180px, calc(100% - 2rem));
  margin: 1.5rem auto 2rem;
  flex: 1;
}

.shell-auth {
  min-height: calc(100vh - 9rem);
  display: grid;
  align-items: center;
}

.flash-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
}

.flash-success {
  border-color: rgba(20, 108, 67, 0.3);
  color: var(--ok);
}

.flash-error {
  border-color: rgba(161, 29, 29, 0.3);
  color: var(--danger);
}

.auth-stage {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2.5rem;
  align-items: center;
}

.auth-copy .eyebrow,
.page-head .eyebrow {
  margin: 0 0 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--accent-deep);
}

.brand-hero {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.lede {
  max-width: 30rem;
  font-size: 1.05rem;
  color: var(--ink-soft);
  margin: 1rem 0 0;
}

.auth-cred {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  max-width: 32rem;
}

.auth-cred-label {
  margin: 0 0 0.4rem !important;
  font-size: 0.72rem !important;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep) !important;
}

.auth-cred p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.auth-contacts {
  margin-top: 0.9rem;
  display: grid;
  gap: 0.55rem;
}

.auth-cred a,
.footer-help a {
  color: var(--accent-deep);
  font-weight: 600;
  text-decoration: none;
}

.auth-cred a:hover,
.footer-help a:hover {
  text-decoration: none;
}

.auth-form,
.panel,
.upload-panel,
.preview-frame,
.archive-table {
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.auth-form {
  padding: 1.6rem;
  border-radius: var(--radius);
  display: grid;
  gap: 0.95rem;
}

.auth-form-head h2,
.panel h2,
.page-head h1,
.section-bar h2 {
  font-family: var(--font-display);
  letter-spacing: -0.03em;
  margin: 0;
}

.auth-form-head p {
  margin: 0.3rem 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
}

input[type="text"],
input[type="password"],
input[type="file"],
input[type="search"] {
  font: inherit;
}

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  padding: 0.72rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

input:focus {
  outline: 2px solid rgba(23, 107, 90, 0.28);
  border-color: var(--accent);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 500;
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.72rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-deep);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}

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

.btn-small {
  padding: 0.42rem 0.72rem;
  font-size: 0.84rem;
  border-radius: 8px;
}

.btn.danger,
.danger {
  color: var(--danger);
}

.page-head {
  margin-bottom: 1.25rem;
}

.page-head h1 {
  font-size: clamp(1.7rem, 3vw, 2.15rem);
}

.page-head p {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  max-width: 42rem;
}

.upload-panel {
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.upload-form {
  display: grid;
  gap: 0.85rem;
}

.dropzone {
  position: relative;
  border: 1.5px dashed rgba(15, 74, 62, 0.28);
  border-radius: 12px;
  min-height: 130px;
  background:
    linear-gradient(135deg, rgba(23, 107, 90, 0.06), transparent 55%),
    rgba(255, 255, 255, 0.5);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone.is-drag {
  border-color: var(--accent);
  background: rgba(23, 107, 90, 0.1);
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone-inner {
  pointer-events: none;
  min-height: 130px;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 0.25rem;
  padding: 1rem;
}

.dropzone-inner strong {
  font-family: var(--font-display);
  font-size: 1.08rem;
}

.dropzone-inner span,
.file-meta,
.preview-label,
.empty,
.preview-placeholder,
.section-sub {
  color: var(--ink-soft);
}

.file-chosen {
  margin: 0.5rem 0 0;
  font-weight: 600;
  color: var(--accent-deep);
}

.workspace-grid,
.admin-grid {
  display: grid;
  gap: 1.25rem;
}

.workspace-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.95fr);
  align-items: start;
}

.section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.section-sub {
  margin: 0.2rem 0 0;
  font-size: 0.9rem;
}

.archive-toolbar {
  margin-bottom: 0.75rem;
  display: grid;
  gap: 0.7rem;
}

.archive-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.select-all-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.84rem;
  font-weight: 550;
  margin: 0;
}

.selection-count {
  color: var(--ink-soft);
  font-size: 0.82rem;
  margin-right: auto;
}

#bulk-delete-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.file-check {
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-check input,
.select-all-label input {
  width: 0.95rem;
  height: 0.95rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.file-row.is-checked {
  background: rgba(23, 107, 90, 0.05);
}

.archive-head {
  display: none;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  gap: 0.65rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.col-check {
  text-align: center;
}

.archive-table {
  border-radius: var(--radius);
  overflow: hidden;
}

.file-list,
.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.file-row {
  padding: 0.55rem 0.75rem;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr);
  gap: 0.55rem 0.65rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}

.file-row:last-child {
  border-bottom: 0;
}

.file-row.is-active {
  background: rgba(23, 107, 90, 0.07);
  box-shadow: inset 3px 0 0 var(--accent);
}

.file-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.file-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 5px;
  background: rgba(23, 107, 90, 0.12);
  color: var(--accent-deep);
  font-size: 0.65rem;
  font-weight: 750;
  letter-spacing: 0.06em;
}

.file-copy {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.55rem;
}

.file-name {
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.file-inline-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.2;
  min-width: 0;
}

.file-inline-meta > span:first-child {
  max-width: 16rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta-dot {
  opacity: 0.55;
}

.file-actions,
.user-actions,
.inline-form,
.rename-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.file-actions {
  grid-column: 2;
}

.btn-tiny {
  padding: 0.28rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 7px;
  font-weight: 600;
}

.btn-preview {
  background: rgba(23, 107, 90, 0.1);
  border-color: rgba(23, 107, 90, 0.24);
  color: var(--accent-deep);
}

.btn-preview:hover {
  background: rgba(23, 107, 90, 0.16);
}

.rename-form {
  grid-column: 1 / -1;
}

.rename-form input {
  flex: 1 1 12rem;
  padding: 0.45rem 0.65rem;
  font-size: 0.88rem;
}

.preview-col {
  position: sticky;
  top: 5rem;
}

.preview-frame {
  border-radius: var(--radius);
  min-height: 620px;
  overflow: hidden;
  position: relative;
}

.preview-frame iframe {
  width: 100%;
  height: 620px;
  border: 0;
  background: white;
}

.preview-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 2rem;
  text-align: center;
}

.preview-actions {
  margin-top: 0.75rem;
  display: flex;
  justify-content: flex-end;
}

.archive-empty {
  padding: 1.25rem 1rem;
  margin: 0;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.stat-chip {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.7rem 0.85rem;
  display: grid;
  gap: 0.15rem;
}

.stat-label {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.stat-chip strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
  letter-spacing: -0.03em;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(15rem, 0.78fr) minmax(0, 1.22fr);
  gap: 1rem;
  align-items: start;
}

.admin-side {
  display: grid;
  gap: 0.85rem;
}

.panel {
  border-radius: var(--radius);
  padding: 0.95rem;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.panel-head h2 {
  font-size: 1.05rem;
}

.users-head {
  margin-bottom: 0.85rem;
}

.users-head input {
  width: min(14rem, 100%);
  padding: 0.5rem 0.7rem;
  font-size: 0.88rem;
}

.add-user,
.admin-tools {
  display: grid;
  gap: 0.7rem;
  align-content: start;
}

.compact-fields {
  display: grid;
  gap: 0.55rem;
}

.compact-fields label span,
.manage-form label span {
  font-size: 0.78rem;
}

.compact-fields input,
.manage-form input {
  padding: 0.5rem 0.65rem;
  font-size: 0.88rem;
}

.tool-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.admin-table {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.45);
}

.admin-table-head {
  display: none;
  grid-template-columns: minmax(0, 1.3fr) 5.5rem 7.5rem minmax(12rem, 1fr);
  gap: 0.55rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.user-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.user-row {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  background: transparent;
  display: grid;
  gap: 0;
}

.user-row:last-child {
  border-bottom: 0;
}

.user-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.45rem 0.65rem;
  padding: 0.6rem 0.75rem;
  align-items: center;
}

.user-identity {
  min-width: 0;
  display: grid;
  gap: 0.12rem;
}

.user-name {
  font-size: 0.92rem;
}

.user-inline-meta,
.user-archive-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.28rem;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.role-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.18rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.role-admin {
  background: rgba(23, 107, 90, 0.14);
  color: var(--accent-deep);
}

.role-user {
  background: rgba(18, 26, 34, 0.06);
  color: var(--ink-soft);
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.user-manage,
.user-files {
  padding: 0 0.75rem 0.7rem;
  border-top: 1px dashed var(--line);
  background: rgba(255, 255, 255, 0.35);
}

.user-manage {
  display: grid;
  gap: 0.5rem;
  padding-top: 0.65rem;
}

.manage-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: end;
}

.manage-form label {
  flex: 1 1 10rem;
}

.admin-file-list {
  list-style: none;
  margin: 0;
  padding: 0.55rem 0 0;
  display: grid;
  gap: 0.35rem;
}

.admin-file-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.admin-file-copy {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.45rem;
}

.admin-file-actions {
  display: flex;
  gap: 0.3rem;
  align-items: center;
}

.site-footer {
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.86)),
    rgba(245, 248, 251, 0.9);
  backdrop-filter: blur(12px);
  margin-top: auto;
}

.footer-inner {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.35rem 0 1.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1.25rem 2rem;
  align-items: start;
}

.footer-mark {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 1.05rem;
  color: var(--ink);
  margin-bottom: 0.35rem;
}

.footer-credit {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  max-width: 28rem;
  line-height: 1.55;
}

.footer-support-label {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.footer-contacts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.footer-mail {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
  box-shadow: 0 8px 18px rgba(16, 28, 36, 0.05);
}

.footer-mail:hover {
  border-color: rgba(23, 107, 90, 0.35);
  background: #fff;
  transform: translateY(-1px);
}

.footer-mail-icon {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9px;
  background: rgba(23, 107, 90, 0.1);
  color: var(--accent-deep);
  flex: 0 0 auto;
}

.footer-mail-text {
  display: grid;
  gap: 0.08rem;
  min-width: 0;
}

.footer-mail-title {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.footer-mail-address {
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--ink);
  word-break: break-word;
}

@media (max-width: 920px) {
  .footer-inner,
  .footer-contacts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .footer-inner {
    width: min(100% - 1.25rem, 1180px);
  }
}

@media (min-width: 921px) {
  .archive-head {
    display: grid;
  }

  .file-row {
    grid-template-columns: 2rem minmax(0, 1fr) auto;
  }

  .file-actions {
    grid-column: auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
  }

  .file-copy {
    flex-wrap: nowrap;
  }

  .file-name {
    max-width: min(28rem, 46vw);
  }

  .admin-table-head {
    display: grid;
  }

  .user-main {
    grid-template-columns: minmax(0, 1.3fr) 5.5rem 7.5rem minmax(12rem, 1fr);
  }
}

@media (max-width: 920px) {
  .auth-stage,
  .workspace-grid,
  .admin-layout,
  .admin-stats {
    grid-template-columns: 1fr;
  }

  .preview-col {
    position: static;
  }

  .preview-frame,
  .preview-frame iframe {
    min-height: 420px;
    height: 420px;
  }
}

@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .shell {
    width: min(100% - 1.25rem, 1180px);
  }

  .footer-inner {
    width: min(100% - 1.25rem, 1180px);
  }
}
