/* eboxcy — single stylesheet. No inline styles anywhere (CSP style-src 'self'). */

:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #eef1f5;
  --text: #1b2430;
  --text-muted: #556172;
  --border: #d5dbe3;
  --accent: #1f5fbf;
  --accent-contrast: #ffffff;
  --accent-soft: #e3ecfa;
  --danger: #b3261e;
  --danger-contrast: #ffffff;
  --danger-soft: #fbe9e7;
  --success: #1e6b3a;
  --success-soft: #e5f4ea;
  --warning: #8a5a00;
  --warning-soft: #fdf3dc;
  --focus: #f0a500;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 1px 3px rgb(16 24 40 / 10%);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #11151b;
    --surface: #1a2029;
    --surface-muted: #232b36;
    --text: #e6eaf0;
    --text-muted: #a3adbb;
    --border: #334050;
    --accent: #7fb0ff;
    --accent-contrast: #0d1520;
    --accent-soft: #1d2d47;
    --danger: #ff8a80;
    --danger-contrast: #2a0d0b;
    --danger-soft: #3a1d1b;
    --success: #7dd69a;
    --success-soft: #16301f;
    --warning: #f3c96b;
    --warning-soft: #352a12;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11151b;
  --surface: #1a2029;
  --surface-muted: #232b36;
  --text: #e6eaf0;
  --text-muted: #a3adbb;
  --border: #334050;
  --accent: #7fb0ff;
  --accent-contrast: #0d1520;
  --accent-soft: #1d2d47;
  --danger: #ff8a80;
  --danger-contrast: #2a0d0b;
  --danger-soft: #3a1d1b;
  --success: #7dd69a;
  --success-soft: #16301f;
  --warning: #f3c96b;
  --warning-soft: #352a12;
  --shadow: none;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

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

[hidden] {
  display: none !important;
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-radius: var(--radius);
  z-index: 10;
}

.skip-link:focus {
  top: 1rem;
}

/* Header */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  text-decoration: none;
  font-weight: 500;
}

.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

.header-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.header-tools form {
  display: flex;
  gap: 0.25rem;
  margin: 0;
}

/* Layout */

.page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.page--narrow {
  max-width: 30rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

h1 {
  font-size: 1.6rem;
  line-height: 1.25;
  margin: 0 0 1rem;
}

h2 {
  font-size: 1.2rem;
  margin: 1.5rem 0 0.75rem;
}

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

.site-footer {
  max-width: 72rem;
  margin: 0 auto;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Forms */

.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="file"],
input:not([type]),
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.header-tools select {
  width: auto;
  min-height: 2.25rem;
  padding: 0.25rem 0.5rem;
}

.errorlist {
  margin: 0.35rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--danger);
  font-size: 0.925rem;
}

.helptext {
  display: block;
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Buttons */

.button,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-contrast);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button--secondary,
.header-tools button {
  background: transparent;
  color: var(--accent);
}

.header-tools button {
  min-height: 2.25rem;
  padding: 0.25rem 0.75rem;
}

.button--danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--danger-contrast);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.actions form {
  margin: 0;
}

/* Messages */

.alert {
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}

.alert--error {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--text);
}

.alert--success {
  background: var(--success-soft);
  border-color: var(--success);
}

.alert--info {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.alert--warning {
  background: var(--warning-soft);
  border-color: var(--warning);
}

/* Lists and tables */

.list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.list > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

.list > li:last-child {
  border-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* File manager */

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
  font-size: 0.925rem;
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: 0.25rem;
  color: var(--text-muted);
}

.breadcrumbs li,
.item-name {
  overflow-wrap: anywhere;
}

.page-heading,
.list-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 1rem;
}

.page-heading h1,
.list-heading h2 {
  margin: 0;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 0.75rem;
}

.inline-form .field {
  flex: 1 1 16rem;
  margin-bottom: 0;
}

.sort-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.sort-form select {
  width: auto;
}

.item-list .item-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.6rem;
  flex: 1 1 18rem;
  min-width: 0;
}

.item-kind {
  display: inline-block;
  min-width: 3.5rem;
  padding: 0.05rem 0.4rem;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

.item-meta {
  flex-basis: 100%;
  font-size: 0.875rem;
}

.button--link {
  min-height: 2.75rem;
  padding: 0.25rem 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.item-list .actions a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

code,
.code {
  font-family: var(--mono);
  font-size: 0.95em;
  overflow-wrap: anywhere;
}

.recovery-codes {
  columns: 2 12rem;
  font-family: var(--mono);
}

@media (max-width: 40rem) {
  h1 {
    font-size: 1.35rem;
  }

  .page {
    padding-top: 1rem;
  }

  .card {
    padding: 1rem;
  }
}

.upload-row {
  display: grid;
  gap: 0.25rem;
  margin-block: 0.75rem;
}

.upload-row progress {
  width: 100%;
}

.card progress {
  width: 100%;
}

/* Owner administration */

.status {
  white-space: nowrap;
}

.status--ok {
  color: var(--success);
}

.status--warning {
  color: var(--warning);
}

.status--failed {
  color: var(--danger);
}

.token {
  font-family: var(--mono);
}
