* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: #f0f2f5;
  color: #1e293b;
  min-height: 100vh;
}

#app { max-width: 960px; margin: 0 auto; padding: 32px 20px; }

/* ─── Header ─── */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}

h1 { font-size: 28px; font-weight: 700; }

.subtitle { font-size: 14px; color: #94a3b8; margin-top: 4px; }

.badge {
  display: inline-block;
  background: #eef2ff;
  color: #0b5ca8;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

/* ─── Toolbar ─── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.api-status {
  font-size: 13px;
  color: #22c55e;
}

/* ─── Buttons ─── */
.btn {
  height: 40px;
  padding: 0 24px;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.btn-primary { background: #0b5ca8; color: #fff; }
.btn-primary:hover { background: #094d8f; }

.btn-cancel { background: #f1f5f9; color: #64748b; }
.btn-cancel:hover { background: #e2e8f0; }

.btn-danger {
  background: transparent;
  color: #dc2626;
  font-size: 13px;
  padding: 0 12px;
  height: 32px;
}
.btn-danger:hover { background: #fef2f2; }

.btn-edit {
  background: transparent;
  color: #0b5ca8;
  font-size: 13px;
  padding: 0 12px;
  height: 32px;
}
.btn-edit:hover { background: #eef2ff; }

/* ─── Device Grid ─── */
.device-grid { display: flex; flex-direction: column; gap: 12px; }

.device-card {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow .15s;
}
.device-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }

.card-image {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: #f1f5f9;
  object-fit: contain;
  flex-shrink: 0;
}

.card-info { flex: 1; margin-left: 16px; min-width: 0; }

.card-name { font-size: 16px; font-weight: 600; }

.card-id { font-size: 12px; color: #94a3b8; margin-top: 2px; }

.card-actions { display: flex; gap: 4px; flex-shrink: 0; margin-left: 12px; }

/* ─── Empty ─── */
.empty {
  display: none;
  text-align: center;
  padding: 60px 0;
  color: #94a3b8;
}
.empty.visible { display: block; }
.empty .hint { font-size: 13px; margin-top: 8px; }

/* ─── Company Section ─── */
.company-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid #e2e8f0;
}

.section-title {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 16px;
}

.company-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.company-field { display: flex; flex-direction: column; gap: 6px; }
.company-field label { font-size: 13px; font-weight: 600; color: #475569; }
.company-field input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}
.company-field input:focus { border-color: #0b5ca8; }

.company-row { display: flex; gap: 12px; }
.company-field.half { flex: 1; }

.company-card .btn { align-self: flex-start; margin-top: 4px; }

/* ─── Image Upload ─── */
.image-upload-row { display: flex; gap: 16px; align-items: flex-start; }
.upload-area {
  width: 120px;
  height: 120px;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  flex-shrink: 0;
}
.upload-area:hover { border-color: #0b5ca8; background: #f8fafc; }
.upload-area.has-image { border-style: solid; border-color: #22c55e; }
.upload-icon { font-size: 28px; line-height: 1; }
.upload-text { font-size: 12px; color: #64748b; margin-top: 6px; }
.preview {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  object-fit: cover;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

/* ─── Showcase Section ─── */
.showcase-section {
  margin-bottom: 32px;
  padding: 28px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}

.showcase-section .section-title { margin-bottom: 6px; }

.showcase-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed #e2e8f0;
}

.showcase-card:first-of-type { border-top: none; padding-top: 0; }

.showcase-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
}

.showcase-card .btn { align-self: flex-start; }

.preview-lg {
  width: 200px;
  height: 340px;
}

.preview-wide {
  width: 320px;
  height: 128px;
}

/* ─── Article Section ─── */
.article-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid #e2e8f0;
}

.article-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.article-head .section-title { margin-bottom: 0; }

.section-hint {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 16px;
}

.article-list { display: flex; flex-direction: column; gap: 12px; }

.article-card {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 14px;
  padding: 16px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: box-shadow .15s;
}
.article-card:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }

.article-thumb {
  width: 72px;
  height: 72px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f1f5f9;
}

.article-info {
  flex: 1;
  min-width: 0;
  margin-left: 16px;
}

.article-title {
  font-size: 16px;
  font-weight: 600;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-summary {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-date {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 6px;
}

.form-textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.6;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
  transition: border-color .15s;
}
.form-textarea:focus { border-color: #0b5ca8; }

.modal-lg { width: 520px; }

/* ─── Footer ─── */
footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
}
footer code {
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

/* ─── Modal ─── */
.modal-mask {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
}
.modal-mask.show { display: block; }

.modal {
  display: none;
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 18px;
  padding: 32px;
  width: 440px;
  max-width: 92vw;
  z-index: 1000;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal.show { display: block; }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 28px;
}
.modal-head h2 { font-size: 20px; }

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: #f1f5f9;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  color: #64748b;
}

.form-group { margin-bottom: 20px; }
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 8px;
}
.form-group input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color .15s;
}
.form-group input:focus { border-color: #0b5ca8; }

/* old image-row removed — now using .image-upload-row */

.modal-foot {
  display: flex;
  gap: 12px;
  margin-top: 28px;
}
.modal-foot .btn { flex: 1; height: 44px; }

/* ─── 隐藏类 ─── */
.hidden { display: none !important; }

/* ─── 登录页面 ─── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.login-box {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-header {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo {
  font-size: 56px;
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 14px;
  color: #94a3b8;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.login-field label {
  font-size: 14px;
  font-weight: 600;
  color: #475569;
}

.login-field input {
  height: 48px;
  padding: 0 16px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

.login-field input:focus {
  border-color: #0b5ca8;
  box-shadow: 0 0 0 3px rgba(11,92,168,0.1);
}

.login-error {
  color: #dc2626;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
}

.login-btn {
  height: 50px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-top: 8px;
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ─── 退出按钮 ─── */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-logout {
  height: 36px;
  font-size: 13px;
  padding: 0 16px;
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
  #app { padding: 20px 14px; }
  header { flex-direction: column; gap: 12px; }
  .header-right { align-self: stretch; justify-content: space-between; }
  .badge { align-self: flex-start; }
  .device-card { flex-wrap: wrap; }
  .card-actions { margin-left: auto; margin-top: 0; }
  .login-box { padding: 36px 28px; }
}