@font-face {
  font-family: "Inter";
  src: url("fonts/inter-latin-var.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #0a2420;
  --ink-2: #123a32;
  --muted: #5c6d67;
  --paper: #f5f7f4;
  --paper-2: #eef2ec;
  --surface: #ffffff;
  --line: rgba(10, 36, 32, 0.12);
  --line-strong: rgba(10, 36, 32, 0.22);
  --accent: #167a5b;
  --accent-soft: #dff3e8;
  --accent-bright: #8ef0c4;
  --danger: #a63a2b;
  --danger-soft: #fbe9e6;
  --warn: #9a6418;
  --warn-soft: #fbf0dc;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --shadow: 0 18px 50px rgba(10, 36, 32, 0.08);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection {
  background: var(--accent-bright);
  color: var(--ink);
}

code {
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--paper-2);
  font-size: 0.85em;
}

/* Layout */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #08211d;
  color: #edf5f0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(100% - 40px, 1180px);
  min-height: 68px;
  margin-inline: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.brand-name span {
  color: var(--accent-bright);
}

.brand-tag {
  margin-left: 3px;
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: rgba(237, 245, 240, 0.6);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.86rem;
  font-weight: 500;
}

.topnav > a {
  color: rgba(237, 245, 240, 0.72);
  transition: color 0.18s ease;
}

.topnav > a:hover,
.topnav > a.active {
  color: #ffffff;
}

.nav-user {
  max-width: 220px;
  overflow: hidden;
  color: rgba(237, 245, 240, 0.46);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-form {
  display: inline;
  margin: 0;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: rgba(237, 245, 240, 0.72);
  font-size: 0.86rem;
  font-weight: 500;
}

.link-button:hover {
  color: #ffffff;
}

.page {
  width: min(100% - 40px, 1080px);
  margin-inline: auto;
  padding: 54px 0 96px;
}

.page--wide {
  max-width: 1220px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 34px;
}

.page-head h1 {
  margin-top: 8px;
  font-size: clamp(2.3rem, 5vw, 3.6rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.055em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lede {
  max-width: 620px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.7;
}

.muted {
  color: var(--muted);
}

.inline-error {
  margin-top: 14px;
  color: var(--danger);
  font-size: 0.82rem;
  line-height: 1.5;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: min(100% - 40px, 1180px);
  margin-inline: auto;
  padding: 24px 0 34px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.74rem;
}

.footer a {
  color: var(--accent);
}

/* Buttons and badges */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: wait;
  opacity: 0.6;
  transform: none;
}

.btn svg {
  transition: transform 0.18s ease;
}

.btn:hover svg {
  transform: translateX(2px);
}

.btn--primary {
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 8px 22px rgba(10, 36, 32, 0.16);
}

.btn--primary:hover {
  background: var(--ink-2);
}

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

.btn--ghost:hover {
  background: rgba(10, 36, 32, 0.04);
}

.btn--small {
  min-height: 38px;
  padding: 0 16px;
  font-size: 0.8rem;
}

.btn--tiny {
  min-height: 30px;
  padding: 0 10px;
  font-size: 0.7rem;
}

.btn--block {
  width: 100%;
}

.topnav .btn--small {
  background: var(--accent-bright);
  color: var(--ink);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge--ok {
  background: #e3f5ea;
  color: #126146;
}

.badge--warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge--error {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge--muted {
  background: var(--paper-2);
  color: var(--muted);
}

.badge--accent {
  background: var(--accent-soft);
  color: var(--accent);
}

.flash {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.5;
}

.flash--success {
  border-color: rgba(22, 122, 91, 0.25);
  background: var(--accent-soft);
  color: var(--accent-2);
}

.flash--error {
  border-color: rgba(166, 58, 43, 0.22);
  background: var(--danger-soft);
  color: var(--danger);
}

.flash--info {
  background: var(--paper-2);
  color: var(--muted);
}

/* Auth */

.auth-wrap {
  display: grid;
  min-height: calc(100vh - 190px);
  place-items: center;
  padding: 24px 0;
  background:
    radial-gradient(ellipse 60% 60% at 80% 10%, rgba(94, 230, 167, 0.12), transparent 65%),
    radial-gradient(ellipse 50% 50% at 10% 90%, rgba(22, 122, 91, 0.08), transparent 70%);
  border-radius: 24px;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card--wide {
  max-width: 660px;
}

.auth-card h1 {
  margin-top: 12px;
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.auth-card .lede {
  margin-top: 12px;
  font-size: 0.9rem;
}

.form-stack {
  display: grid;
  gap: 16px;
  margin-top: 26px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-stack label {
  display: grid;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 600;
}

.form-stack input,
.form-stack select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fbfcfb;
  font-size: 0.88rem;
  font-weight: 400;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.form-stack input:focus,
.form-stack select:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(22, 122, 91, 0.12);
}

.form-stack select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='m6 9 6 6 6-6' stroke='%235c6d67' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.auth-alt {
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.auth-alt a {
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.success-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
}

.billing-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 26px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.billing-plan-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}

.billing-plan .muted {
  display: block;
  margin-top: 4px;
  font-size: 0.75rem;
}

.billing-plan-price {
  display: flex;
  align-items: baseline;
  white-space: nowrap;
}

.billing-plan-price strong {
  font-size: 1.8rem;
  letter-spacing: -0.05em;
}

.billing-plan-price span {
  margin-left: 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

.billing-annual {
  margin: 12px 0 20px;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Cards */

.upload-card,
.files-card,
.admin-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

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

.files-head h2 {
  margin-top: 5px;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.files-head .muted {
  max-width: 660px;
  margin-top: 6px;
  font-size: 0.8rem;
  line-height: 1.6;
}

.upload-icon,
.empty-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.inline-form {
  display: inline;
  margin: 0;
}

.vault-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.vault-strip .muted {
  font-size: 0.78rem;
}

.vault-strip .inline-form {
  display: inline;
  margin-left: auto;
}

.demo-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
  padding: 14px 16px;
  border: 1px solid rgba(22, 122, 91, 0.22);
  border-radius: 12px;
  background: var(--accent-soft);
}

.demo-banner p {
  flex: 1;
  min-width: 220px;
  color: var(--accent-2);
  font-size: 0.8rem;
  line-height: 1.55;
}

.filex-shell {
  min-height: 72vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

/* Keep the embedded explorer chrome, but not the internal storage address or
   a second copy of the KovakVault brand. */
.filex-shell .fe-breadcrumb__crumb:first-child,
.filex-shell .fe-breadcrumb__edit,
.filex-shell .fe-toolbar__brand {
  display: none !important;
}

.filex-shell filex-explorer {
  display: block;
  min-height: 72vh;
  --fe-primary: var(--accent);
  --fe-primary-ink: #ffffff;
  --fe-primary-soft: var(--accent-soft);
  --fe-bg: var(--surface);
  --fe-bg-elev: var(--paper);
  --fe-bg-hover: var(--paper-2);
  --fe-bg-selected: var(--accent-soft);
  --fe-text: var(--ink);
  --fe-text-muted: var(--muted);
  --fe-border: var(--line);
  --fe-border-soft: var(--line);
  --fe-border-strong: var(--line-strong);
  --fe-font: var(--font);
  --fe-radius: 10px;
  --fe-radius-sm: 7px;
  --fe-radius-md: 12px;
}

.filex-name {
  margin-top: 3px;
  font-size: 0.68rem;
  white-space: nowrap;
}

/* Upload */

.upload-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  margin-bottom: 18px;
}

.upload-copy {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.upload-copy strong {
  font-size: 0.86rem;
}

.upload-copy .muted {
  margin-top: 2px;
  font-size: 0.76rem;
}

.upload-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.upload-form input[type="file"] {
  max-width: 230px;
  color: var(--muted);
  font-size: 0.76rem;
}

.upload-form input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
}

.upload-progress {
  flex-basis: 100%;
  padding-top: 4px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-2);
}

.progress-track progress {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  appearance: none;
  background: transparent;
}

.progress-track progress::-webkit-progress-bar {
  background: transparent;
}

.progress-track progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent), #41c796);
}

.progress-track progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent), #41c796);
}

.upload-progress p {
  margin-top: 7px;
  font-size: 0.74rem;
}

/* Files */

.files-card {
  padding: 24px;
}

.files-head {
  margin-bottom: 18px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.76rem;
}

.breadcrumbs a {
  color: var(--accent);
}

.breadcrumbs span {
  color: var(--ink);
}

.crumb-sep {
  color: var(--muted) !important;
}

.back-link {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 500;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.file-table,
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.file-table th,
.admin-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.file-table td,
.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.file-table tr:last-child td,
.admin-table tr:last-child td {
  border-bottom: 0;
}

.file-table tbody tr:hover,
.admin-table tbody tr:hover {
  background: rgba(238, 242, 236, 0.6);
}

.file-name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
  font-weight: 500;
}

.file-name:hover {
  color: var(--accent);
}

.file-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--paper-2);
  color: var(--muted);
}

.file-icon--folder {
  background: var(--accent-soft);
  color: var(--accent);
}

.cell-action {
  width: 40px;
  text-align: right;
}

.icon-link {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
}

.icon-link:hover {
  background: var(--accent-soft);
}

.empty-state {
  display: grid;
  place-items: center;
  padding: 54px 20px;
  text-align: center;
}

.empty-state h3 {
  margin-top: 12px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.empty-state p {
  max-width: 380px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

/* Admin */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 500;
}

.stat-card strong {
  display: block;
  margin-top: 5px;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.notice-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.notice-row p {
  font-size: 0.78rem;
}

.admin-card {
  padding: 24px;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 180px;
}

.user-cell span:last-child {
  display: flex;
  flex-direction: column;
}

.user-cell strong {
  font-size: 0.8rem;
  font-weight: 600;
}

.user-cell small {
  color: var(--muted);
  font-size: 0.7rem;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 600;
}

.box-details {
  min-width: 150px;
  font-size: 0.72rem;
}

.box-details summary {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
}

.box-details summary::-webkit-details-marker {
  display: none;
}

.box-details dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 8px;
  margin: 8px 0 0;
  padding: 8px;
  border-radius: 8px;
  background: var(--paper);
  font-size: 0.68rem;
}

.box-details dt {
  color: var(--muted);
}

.box-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.cell-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 130px;
}

.empty-page {
  display: grid;
  min-height: 50vh;
  place-items: center;
  text-align: center;
}

.empty-page h1 {
  max-width: 620px;
  margin: 12px 0 24px;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.05em;
}

/* Responsive */

@media (max-width: 900px) {
  .topbar-inner {
    min-height: 62px;
  }

  .topnav {
    gap: 14px;
  }

  .nav-user {
    display: none;
  }

  .page {
    padding-top: 34px;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 680px) {
  .topbar-inner {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 0;
  }

  .topnav {
    width: 100%;
    justify-content: flex-end;
    padding-bottom: 2px;
  }

  .brand-tag {
    display: none;
  }

  .page {
    width: min(100% - 28px, 1220px);
    padding-bottom: 64px;
  }

  .page-head,
  .files-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 26px;
  }

  .upload-card {
    align-items: flex-start;
  }

  .upload-form {
    width: 100%;
    flex-wrap: wrap;
  }

  .upload-form input[type="file"] {
    max-width: 100%;
    flex: 1 1 200px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

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