:root {
  --bg: #eef2f5;
  --card: #ffffff;
  --text: #1d2733;
  --muted: #5f6b7a;
  --primary: #1363df;
  --danger: #c73636;
  --border: #d7dde6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}

.page {
  min-height: 100vh;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
}

h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

h2 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.crumbs a {
  color: var(--primary);
  text-decoration: none;
}

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.inline-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  gap: 8px;
}

.login-card {
  max-width: 360px;
  margin: 8vh auto 0;
}

input[type="text"],
input[type="password"],
input[type="file"],
input:not([type]),
select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 200px;
  background: white;
  font-size: 1rem;
}

button,
.button-link {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--primary);
  color: white;
  text-decoration: none;
  cursor: pointer;
  font-size: 1rem;
}

button.secondary {
  background: #475569;
}

.button-link.secondary {
  background: #475569;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 auto;
}

th,
td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  overflow-wrap: anywhere;
}

th:nth-child(2),
td:nth-child(2) {
  min-width: 120px;
  width: 120px;
}

th:nth-child(4),
td:nth-child(4) {
  min-width: 140px;
  width: 140px;
  white-space: nowrap;
}

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

.actions.wrap {
  flex-wrap: wrap;
}

.actions form {
  margin: 0;
}

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

.item-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  text-decoration: none;
}

.item-name:hover {
  text-decoration: underline;
}

.inline-download {
  margin-left: 8px;
  padding: 4px 8px;
  font-size: 0.85rem;
  display: inline-block;
  white-space: nowrap;
}

.item-icon {
  display: inline-block;
  flex: 0 0 auto;
}

.item-icon.folder {
  position: relative;
  width: 16px;
  height: 11px;
  margin-top: 3px;
  border: 1px solid #af7d00;
  border-radius: 2px;
  background: #f3c654;
}

.item-icon.folder::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 1px;
  width: 8px;
  height: 4px;
  border: 1px solid #af7d00;
  border-bottom: none;
  border-radius: 2px 2px 0 0;
  background: #f7d171;
}

.item-icon.file {
  position: relative;
  width: 12px;
  height: 14px;
  border: 1px solid #475569;
  border-radius: 2px;
  background: #ffffff;
}

.item-icon.file::before {
  content: "";
  position: absolute;
  top: -1px;
  right: -1px;
  width: 5px;
  height: 5px;
  border-left: 1px solid #475569;
  border-bottom: 1px solid #475569;
  background: #dbe4ef;
}

.alerts {
  margin-bottom: 12px;
}

.alert {
  padding: 8px 10px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.alert.success {
  background: #e8f6ea;
  color: #0e6b21;
}

.alert.error {
  background: #fde8e8;
  color: #8d1f1f;
}

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

.small {
  font-size: 0.9rem;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.95rem;
}

code {
  background: #f0f3f7;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 6px;
  display: inline-block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

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

.account-form {
  max-width: 420px;
}

@media (max-width: 700px) {
  .page {
    padding: 12px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .toolbar,
  .inline-form,
  .upload-form {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  input[type="text"],
  input[type="password"],
  input[type="file"],
  input:not([type]),
  select,
  button,
  .button-link {
    width: 100%;
    min-width: 0;
  }

  .table-wrap .inline-download {
    width: auto;
    min-width: 0;
  }

}
