* {
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f5f5;
  color: #1a1a1a;
  overscroll-behavior: none;
}

body {
  padding-bottom: 80px;
  min-height: 100dvh;
}

.container {
  padding: 16px;
  max-width: 100%;
}

h1 {
  font-size: 1.5rem;
  margin: 0 0 16px 0;
  font-weight: 700;
}

/* Card */
.card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 4px 0;
}

.card-sub {
  font-size: 0.8rem;
  color: #666;
}

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-card .num {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
}

.stat-card .label {
  font-size: 0.7rem;
  color: #666;
  margin: 2px 0 0 0;
}

/* Article list */
.article-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.article-item:last-child {
  border-bottom: none;
}

.article-info {
  flex: 1;
  min-width: 0;
}

.article-info .title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 2px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-info .meta {
  font-size: 0.75rem;
  color: #666;
}

/* Badge */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.badge-published {
  background: #e8f5e9;
  color: #2e7d32;
}

.badge-draft {
  background: #fff3e0;
  color: #e65100;
}

/* Tags */
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  background: #e3f2fd;
  color: #1565c0;
  font-size: 0.7rem;
  margin: 1px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: opacity 0.15s;
}

.btn:active {
  opacity: 0.7;
}

.btn-primary {
  background: #1976d2;
  color: #fff;
}

.btn-danger {
  background: #d32f2f;
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid #1976d2;
  color: #1976d2;
  padding: 8px 16px;
  min-height: 36px;
  font-size: 0.8rem;
  border-radius: 8px;
}

.btn-sm {
  padding: 6px 12px;
  min-height: 32px;
  font-size: 0.75rem;
  border-radius: 8px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 10px;
  font-size: 1.2rem;
}

/* Inputs */
input, select, textarea {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid #ddd;
  border-radius: 10px;
  font-size: 1rem;
  background: #fff;
  margin-bottom: 12px;
  -webkit-appearance: none;
  appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: #1976d2;
  outline: none;
}

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
  color: #333;
}

/* Bottom navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  display: flex;
  justify-content: space-around;
  padding: 6px 0;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  box-shadow: 0 -1px 3px rgba(0,0,0,0.1);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 8px;
  text-decoration: none;
  color: #888;
  font-size: 0.6rem;
  font-weight: 600;
  min-width: 50px;
}

.nav-item.active {
  color: #1976d2;
}

.nav-item .icon {
  font-size: 1.3rem;
  line-height: 1;
}

/* Top bar */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 0 16px;
}

.top-bar h1 {
  margin: 0;
}

/* Form group */
.form-group {
  margin-bottom: 16px;
}

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

.form-row > * {
  flex: 1;
}

/* Setting group */
.setting-group {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.setting-group h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

/* Switch/ Toggle */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.toggle-wrap label {
  margin: 0;
}

.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  position: absolute;
}

.toggle .slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 28px;
  transition: 0.2s;
}

.toggle .slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: 0.2s;
}

.toggle input:checked + .slider {
  background: #1976d2;
}

.toggle input:checked + .slider::before {
  transform: translateX(20px);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #888;
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* Spinner */
.spinner {
  text-align: center;
  padding: 40px;
  color: #888;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.spinner::after {
  content: "Loading...";
  animation: pulse 1.5s ease-in-out infinite;
}

/* utility */
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: #888; font-size: 0.8rem; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* table alternative */
.list-card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.list-item {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  gap: 8px;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item .primary {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
}

.list-item .secondary {
  font-size: 0.8rem;
  color: #666;
}

/* Save bar */
.save-bar {
  position: fixed;
  bottom: 80px;
  left: 16px;
  right: 16px;
  z-index: 99;
}

.save-bar button {
  width: 100%;
  padding: 16px;
  border: none;
  border-radius: 12px;
  background: #1976d2;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(25,118,210,0.3);
}

.save-bar button:active {
  opacity: 0.8;
}
