:root {
  --ink: #141414;
  --muted: #707070;
  --line: #ececef;
  --soft: #f3f3f5;
  --bg: #ffffff;
  --blue: #2643f2;
  --green: #0f8a4b;
  --red: #c8322b;
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 32px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }

label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
input, select, textarea {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 20px;
  border: 0; border-radius: 999px;
  font: inherit; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn--sm { height: 34px; padding: 0 14px; font-size: 13px; }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: #2a2a2e; }
.btn--light { background: var(--soft); color: var(--ink); }
.btn--light:hover { background: #e8e8ec; }
.link { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; }
.error { color: var(--red); font-size: 13px; margin: 0; }

.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; background: #fff; }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--soft); }
.auth__box { width: 100%; max-width: 380px; background: #fff; border-radius: 24px; padding: 36px; display: flex; flex-direction: column; gap: 16px; }
.auth__logo { height: 22px; align-self: flex-start; }

/* nav */
.nav {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 32px;
  background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.nav__logo { height: 22px; }
.nav__right { display: flex; align-items: center; gap: 14px; }
.pill { width: auto; border-radius: 999px; padding: 6px 12px; }

.page { max-width: 1120px; margin: 0 auto; padding: 32px; }

.empty { text-align: center; padding: 96px 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }

.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.stats { display: flex; gap: 12px; }
.stat { background: var(--soft); border-radius: var(--radius); padding: 14px 20px; min-width: 120px; }
.stat b { display: block; font-size: 24px; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: 13px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tab {
  background: none; border: 0; font: inherit; font-weight: 500; color: var(--muted);
  padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.is-active { color: var(--ink); border-color: var(--ink); }

.grid2 { display: grid; grid-template-columns: 1fr 360px; gap: 28px; align-items: start; }

/* rules */
.rule { display: flex; flex-direction: column; gap: 10px; }
.rule__top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.rule__meta { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { background: var(--soft); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 500; }
.chip--blue { background: #e9ecfe; color: var(--blue); }
.reply { background: var(--soft); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.reply b { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.rule.is-off { opacity: .55; }
.rule__actions { display: flex; gap: 12px; align-items: center; }

.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #d5d5da; border-radius: 999px; transition: background .2s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

/* posts */
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.post { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; cursor: pointer; text-align: left; padding: 0; font: inherit; color: inherit; }
.post:hover { border-color: #d8d8de; }
.post__img { aspect-ratio: 4 / 5; background: var(--soft) center / cover no-repeat; position: relative; }
.post__type { position: absolute; top: 10px; left: 10px; background: rgba(20, 20, 20, .7); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.post__body { padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.post__caption { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 1.5em; }
.post__nums { display: flex; gap: 14px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* drawer */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%);
  background: #fff; border-left: 1px solid var(--line); box-shadow: -12px 0 40px rgba(0, 0, 0, .06);
  padding: 24px; overflow-y: auto; z-index: 20; display: flex; flex-direction: column; gap: 14px;
}
.drawer__head { display: flex; justify-content: space-between; align-items: center; }
.comment { border-bottom: 1px solid var(--line); padding-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.comment__who { font-weight: 600; font-size: 14px; }
.comment__reply { display: flex; gap: 8px; }
.comment__reply input { padding: 8px 10px; }

/* activity */
.table-wrap { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.status { font-weight: 600; }
.status--sent { color: var(--green); }
.status--failed { color: var(--red); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; z-index: 30;
}
.placeholder { color: var(--muted); padding: 24px 0; }

@media (max-width: 860px) {
  .grid2 { grid-template-columns: 1fr; }
  .page { padding: 20px; }
  .nav { padding: 0 20px; }
  .stats { width: 100%; }
  .stat { flex: 1; min-width: 0; }
}
