.admin-shell {
  min-height: 100vh;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid rgba(23, 34, 29, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--teal-dark);
  text-decoration: none;
}

.admin-layout {
  display: grid;
  grid-template-columns: var(--editor-width, 320px) 6px 1fr;
  gap: 0;
  align-items: start;
}

.admin-layout.is-login {
  display: grid;
  grid-template-columns: minmax(280px, 440px);
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 150px);
}

.admin-layout.is-login .admin-resizer {
  display: none;
}

.admin-panel {
  border: 1px solid rgba(23, 34, 29, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
  padding: 18px;
}

.login-panel {
  grid-column: 1 / -1;
  width: min(440px, 100%);
}

.admin-layout.is-login .login-panel {
  width: 100%;
}

.editor-panel {
  position: sticky;
  top: 18px;
}

.admin-panel h2,
.admin-item h3 {
  margin: 0;
}

.admin-panel p {
  margin: 6px 0 0;
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.form-stack label {
  display: grid;
  gap: 6px;
}

.form-stack span {
  color: var(--muted);
  font-size: 0.92rem;
}

.form-stack input,
.form-stack textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  outline: 0;
}

.form-stack input {
  min-height: 42px;
  padding: 0 11px;
}

.form-stack textarea {
  resize: vertical;
  padding: 10px 11px;
  line-height: 1.5;
}

.admin-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.pagination span {
  color: var(--muted);
  font-size: 0.9rem;
}

.item-checkbox {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--teal);
  flex-shrink: 0;
}

.admin-item {
  display: flex;
  gap: 14px;
  align-items: start;
  padding: 14px;
  border: 1px solid rgba(23, 34, 29, 0.12);
  border-radius: 8px;
  background: var(--surface);
}

.admin-item-main {
  flex: 1;
  min-width: 0;
}

.batch-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  margin-top: 12px;
  border: 1px solid rgba(182, 74, 53, 0.24);
  border-radius: 8px;
  background: #fff5f2;
}

.batch-bar span {
  color: var(--rust);
  font-size: 0.92rem;
  font-weight: 500;
}

.admin-item a {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  color: var(--teal-dark);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-item .tag-row {
  margin-top: 10px;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.danger-button {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(182, 74, 53, 0.36);
  border-radius: 8px;
  background: #fff0ed;
  color: var(--rust);
}

.section-divider {
  margin: 20px 0 14px;
  border: none;
  border-top: 1px solid var(--line);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-title h3 {
  margin: 0;
}

.import-export-actions {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.ie-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ie-label {
  color: var(--muted);
  font-size: 0.92rem;
  min-width: 40px;
}

.ie-status {
  color: var(--muted);
  font-size: 0.85rem;
}

.file-upload-button {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  min-height: 34px;
  font-size: 0.9rem;
}

.file-upload-button input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.category-tree-combo {
  position: relative;
}

.combo-input-row {
  display: flex;
  gap: 6px;
}

.combo-input-row input {
  flex: 1;
  min-width: 0;
}

.icon-button {
  min-height: 42px;
  min-width: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-button:hover {
  background: var(--line);
}

.category-tree-dropdown {
  position: absolute;
  z-index: 100;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tree-node {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.9rem;
}

.tree-node:hover {
  background: var(--field);
}

.tree-node--folder {
  color: var(--muted);
  font-weight: 500;
}

.tree-node--leaf {
  color: var(--ink);
}

.tree-sub {
  /* no extra padding, indentation handled by tree-node padding */
}

.toast {
  position: fixed;
  z-index: 1000;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100% - 40px));
  padding: 12px 14px;
  border: 1px solid rgba(23, 34, 29, 0.16);
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: var(--shadow);
}

.admin-resizer {
  width: 6px;
  cursor: col-resize;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  align-self: stretch;
}

.admin-resizer::before {
  content: "";
  position: absolute;
  left: -7px;
  right: -7px;
  top: 0;
  bottom: 0;
}

.admin-resizer::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: transparent;
  transition: background 0.2s;
}

.admin-resizer:hover::after,
.admin-resizer.active::after {
  background: var(--teal);
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-resizer {
    display: none;
  }

  .editor-panel {
    position: static;
  }

  .login-panel {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .admin-actions {
    width: 100%;
    justify-content: space-between;
  }

  .admin-item {
    flex-wrap: wrap;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .batch-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}
