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

body {
  font-family: 'Inter', sans-serif;
  background: #FAFAFA;
  color: #0A0A0A;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ═══ Layout ═══ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  background: #0A0A0A;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
}

.sidebar .logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid #262626;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar .logo span { color: #737373; font-weight: 400; }
.sidebar .logo .close { display: none; background: none; border: none; color: #A3A3A3; font-size: 18px; cursor: pointer; }

.sidebar nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  color: #A3A3A3;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 2px solid transparent;
  background: none;
  border-top: none; border-right: none; border-bottom: none;
  width: 100%;
  text-align: left;
}
.sidebar nav a:hover { color: #fff; background: #171717; }
.sidebar nav a.active { color: #fff; background: #171717; border-left-color: #fff; }

.sidebar .user {
  padding: 16px 20px;
  border-top: 1px solid #262626;
  font-size: 12px;
  color: #525252;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.sidebar .user .email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .user button {
  background: none; border: none; color: #737373; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.sidebar .user button:hover { color: #fff; }

.main { margin-left: 240px; flex: 1; min-height: 100vh; }

.topbar {
  height: 56px;
  border-bottom: 1px solid #E5E5E5;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.topbar h1 { font-size: 16px; font-weight: 600; }
.topbar .toggle {
  display: none;
  background: none; border: 1px solid #E5E5E5; border-radius: 6px;
  font-size: 16px; width: 36px; height: 36px; cursor: pointer;
}
.topbar .actions { display: flex; gap: 8px; }

.content { padding: 32px; }

.card {
  background: #fff;
  border: 1px solid #E5E5E5;
  border-radius: 8px;
  padding: 24px;
}
.card + .card { margin-top: 16px; }
.card-table { padding: 0; overflow: hidden; }

/* ═══ Stats ═══ */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.stat { background: #fff; border: 1px solid #E5E5E5; border-radius: 8px; padding: 20px 24px; }
.stat .value { font-size: 28px; font-weight: 600; line-height: 1.2; }
.stat .label { font-size: 13px; color: #737373; margin-top: 4px; }

/* ═══ Table ═══ */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 12px 16px; border-bottom: 1px solid #E5E5E5;
  font-weight: 600; color: #525252; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
td { padding: 12px 16px; border-bottom: 1px solid #F5F5F5; vertical-align: top; }
tr:hover td { background: #FAFAFA; }

/* ═══ Buttons ═══ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 6px;
  font-size: 13px; font-weight: 500; cursor: pointer; border: none;
  transition: all 0.15s;
  font-family: inherit;
}
.btn-primary { background: #0A0A0A; color: #fff; }
.btn-primary:hover { background: #262626; }
.btn-secondary { background: #F5F5F5; color: #0A0A0A; border: 1px solid #E5E5E5; }
.btn-secondary:hover { background: #E5E5E5; }
.btn-danger { background: #FEF2F2; color: #DC2626; border: 1px solid #FECACA; }
.btn-danger:hover { background: #FEE2E2; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }

/* ═══ Badges ═══ */
.badge {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 999px; font-size: 11px; font-weight: 500;
}
.badge-new { background: #EFF6FF; color: #2563EB; }
.badge-read { background: #F5F5F5; color: #737373; }
.badge-replied { background: #F0FDF4; color: #16A34A; }
.badge-published { background: #F0FDF4; color: #16A34A; }
.badge-draft { background: #FEF3C7; color: #D97706; }

/* ═══ Forms ═══ */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 4px; color: #525252; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid #E5E5E5; border-radius: 6px;
  font-size: 13px; font-family: inherit; outline: none;
  transition: border 0.15s; background: #fff; color: #0A0A0A;
}
.form-group textarea { height: auto; padding: 12px; resize: vertical; min-height: 90px; font-family: 'JetBrains Mono', monospace; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: #0A0A0A; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 12px; justify-content: flex-end; padding-top: 16px; border-top: 1px solid #E5E5E5; }

.hint { font-size: 11px; color: #A3A3A3; margin-top: 4px; }

/* ═══ Misc ═══ */
.empty-state { text-align: center; padding: 48px 24px; color: #A3A3A3; }
.empty-state p { font-size: 14px; }
.list-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.list-head p { font-size: 14px; color: #737373; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.row .grow { flex: 1; min-width: 0; }

/* Login */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #FAFAFA; }
.login { width: 380px; max-width: 90vw; }
.login h1 { font-size: 24px; font-weight: 600; margin-bottom: 4px; }
.login .sub { color: #737373; font-size: 14px; margin-bottom: 32px; }
.login .card { background: #fff; border: 1px solid #E5E5E5; border-radius: 12px; padding: 32px; }
.login label { display: block; font-size: 13px; font-weight: 500; color: #525252; margin-bottom: 4px; }
.login input {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid #E5E5E5; border-radius: 8px; font-size: 14px; font-family: inherit;
  outline: none; transition: border 0.15s;
}
.login input:focus { border-color: #0A0A0A; }
.login .btn { width: 100%; height: 44px; background: #0A0A0A; color: #fff; border: none; border-radius: 8px; font-size: 14px; font-weight: 500; cursor: pointer; margin-top: 8px; }
.login .btn:hover { background: #262626; }
.login .alt { text-align: center; font-size: 13px; color: #737373; margin-top: 16px; }
.login .alt button { background: none; border: none; color: #0A0A0A; font-weight: 600; cursor: pointer; }
.login .error { color: #DC2626; font-size: 13px; margin-top: 12px; text-align: center; }

/* Toast */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  background: #0A0A0A; color: #fff; padding: 12px 20px; border-radius: 8px;
  font-size: 13px; display: none;
  animation: fadeUp 0.3s ease-out;
}
#toast.show { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* Media grid */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.file-item { background: #fff; border: 1px solid #E5E5E5; border-radius: 6px; overflow: hidden; }
.file-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.file-item .placeholder { width: 100%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: #F5F5F5; color: #A3A3A3; font-size: 11px; }
.file-item .info { padding: 8px 10px; }
.file-item .info p { font-size: 11px; color: #525252; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item .actions { padding: 0 10px 10px; }
.drop-zone {
  border: 2px dashed #E5E5E5; border-radius: 8px; padding: 32px;
  text-align: center; color: #A3A3A3; cursor: pointer; transition: all 0.15s;
}
.drop-zone:hover, .drop-zone.drag-over { border-color: #0A0A0A; background: #FAFAFA; }

.seo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

/* Detail list */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.detail-grid .full { grid-column: 1 / -1; }
.detail-label { font-size: 11px; color: #A3A3A3; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.detail-value { font-size: 14px; font-weight: 500; word-break: break-word; }

@media (max-width: 768px) {
  .sidebar { width: 260px; transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar .logo .close { display: block; }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .topbar .toggle { display: inline-flex; align-items: center; justify-content: center; }
  .content { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  table { font-size: 12px; }
  th, td { padding: 8px 10px; }
}
