:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --text: #18212f;
  --muted: #667085;
  --line: #d9e0e7;
  --line-soft: #e9eef3;
  --primary: #2457c5;
  --primary-hover: #1b469f;
  --primary-soft: #e9f0ff;
  --accent: #1d7a62;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(24, 33, 47, 0.08);
  --radius: 8px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(245, 247, 248, 0.96)),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a {
  color: var(--primary);
  font-weight: 650;
  text-decoration: none;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

button,
input {
  font: inherit;
}

button {
  min-height: 40px;
  cursor: pointer;
  border: 0;
  border-radius: var(--radius);
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 22px rgba(36, 87, 197, 0.18);
  transition:
    background 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

button:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 14px 26px rgba(36, 87, 197, 0.22);
}

button:active {
  transform: translateY(0);
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(36, 87, 197, 0.2);
  outline-offset: 3px;
}

input {
  width: 100%;
  min-height: 42px;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface-strong);
  color: var(--text);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(36, 87, 197, 0.1);
}

code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #eef2f5;
  padding: 3px 7px;
  color: #394150;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

.files-body {
  min-height: 100vh;
}

.page {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 36px 24px 48px;
}

.page-header {
  margin-bottom: 22px;
}

.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.page-title-block {
  flex: 1;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-header h1,
.auth-card h1 {
  margin: 0;
  color: var(--text);
  font-size: 38px;
  line-height: 1.1;
  letter-spacing: 0;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 18px 0 14px;
}

.meta-grid p {
  display: grid;
  gap: 4px;
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.meta-grid span {
  color: #667085;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.meta-grid strong {
  color: var(--text);
  font-weight: 750;
}

.breadcrumbs {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  margin: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  padding: 8px 10px;
  color: var(--muted);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.back-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  margin: 12px 0 0;
  border-radius: var(--radius);
  background: var(--primary-soft);
  padding: 8px 12px;
  color: var(--primary);
  font-weight: 750;
}

.crumb-sep {
  color: #98a2b3;
}

.logout-form {
  flex: none;
}

.logout-form button {
  background: #394150;
  box-shadow: none;
}

.logout-form button:hover {
  background: #242c38;
  box-shadow: 0 10px 24px rgba(24, 33, 47, 0.16);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef2f5;
  color: #4a5565;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

tbody tr {
  transition: background 140ms ease;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #f8fbff;
}

td:nth-child(2),
td:nth-child(3) {
  color: var(--muted);
  white-space: nowrap;
}

td:last-child a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  border: 1px solid rgba(36, 87, 197, 0.18);
  border-radius: var(--radius);
  background: var(--primary-soft);
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
}

.inline-form {
  margin: 0;
}

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

.inline-form button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.danger-button {
  background: var(--danger);
  box-shadow: 0 10px 22px rgba(180, 35, 24, 0.14);
}

.danger-button:hover {
  background: #8f1d15;
  box-shadow: 0 14px 26px rgba(180, 35, 24, 0.2);
}

.file-link {
  display: inline-block;
  max-width: 100%;
  color: var(--text);
  overflow-wrap: anywhere;
}

.folder-link {
  color: var(--primary);
  font-weight: 800;
}

.auth-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #f5f7f8 0%, #eef4f2 52%, #f7f8fb 100%);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  border: 1px solid rgba(217, 224, 231, 0.92);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.94);
  padding: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.brand-mark {
  width: 42px;
  height: 42px;
  margin-bottom: 18px;
  border: 1px solid rgba(29, 122, 98, 0.24);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(36, 87, 197, 0.96), rgba(29, 122, 98, 0.96)),
    var(--primary);
  box-shadow: 0 14px 28px rgba(29, 122, 98, 0.2);
}

.auth-card h1 {
  font-size: 30px;
}

.auth-form {
  display: grid;
  gap: 15px;
  margin-top: 20px;
}

.auth-form label {
  display: block;
}

.auth-form span {
  color: #394150;
  font-size: 13px;
  font-weight: 750;
}

.auth-form button {
  width: 100%;
  margin-top: 4px;
}

.muted {
  margin: 8px 0 0;
  color: var(--muted);
}

.error {
  min-height: 1.25em;
  margin: 14px 0 0;
  color: var(--danger);
  font-weight: 650;
}

.notice {
  min-height: 1.25em;
  margin: 14px 0 0;
  color: var(--accent);
  font-weight: 650;
}

.notice:empty,
.error:empty {
  display: none;
}

.auth-link {
  margin: 18px 0 0;
  color: var(--muted);
}

.logout-form.hidden {
  display: none;
}

@media (max-width: 760px) {
  .page {
    padding: 24px 16px 36px;
  }

  .page-header-row {
    flex-direction: column;
  }

  .logout-form,
  .logout-form button {
    width: 100%;
  }

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

@media (max-width: 460px) {
  body {
    font-size: 14px;
  }

  .auth-page {
    padding: 16px;
  }

  .auth-card {
    padding: 24px 20px;
  }

  .page-header h1 {
    font-size: 30px;
  }
}
