:root {
  color-scheme: dark;
  --bg: #08090b;
  --panel: #111318;
  --panel-2: #171a21;
  --line: #292d36;
  --text: #f7f7f8;
  --muted: #9ca3af;
  --red: #e31b35;
  --red-2: #ff4257;
  --green: #42d392;
  --amber: #f2b84b;
  --blue: #579dff;
  --radius: 8px;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top right, rgba(227, 27, 53, 0.22), transparent 28rem),
    linear-gradient(135deg, #08090b 0%, #111217 54%, #090a0c 100%);
  color: var(--text);
}

[hidden] { display: none !important; }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px 18px;
  background: rgba(8, 9, 11, 0.9);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  width: 74px;
  height: 48px;
  object-fit: contain;
  object-position: left center;
  background: #050506;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px;
}

.brand strong, .brand span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong { font-size: 18px; }
.brand span, .eyebrow, .panel p, small { color: var(--muted); }

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item, .task-row {
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  text-align: left;
}

.nav-item span:nth-child(2) {
  flex: 1;
}

.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.nav-item:hover, .nav-item.active {
  color: var(--text);
  border-color: rgba(227, 27, 53, 0.35);
  background: rgba(227, 27, 53, 0.12);
}

.icon, .task-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #20232b;
  color: var(--text);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 18px var(--green);
}

.main-panel {
  min-width: 0;
  padding: 26px;
}

.club-app {
  min-width: 0;
}

.account-line {
  margin: 8px 0 0;
  color: #ff7a88;
  font-weight: 700;
}

.sync-line {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-screen {
  min-height: calc(100vh - 52px);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(430px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card img {
  width: 112px;
  height: 64px;
  object-fit: contain;
  object-position: left center;
  padding: 8px;
  background: #050506;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: #ff7a88;
}

.help-text {
  color: var(--muted);
  font-size: 13px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 4vw, 42px); letter-spacing: 0; }
h2 { margin-bottom: 4px; font-size: 18px; }

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.primary-button, .ghost-button, .filter, .icon-button, .trash-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-2);
  padding: 0 14px;
}

.primary-button {
  border-color: rgba(255, 66, 87, 0.65);
  background: linear-gradient(135deg, var(--red), #9d1020);
  box-shadow: 0 10px 28px rgba(227, 27, 53, 0.28);
  font-weight: 700;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--panel-2);
  text-decoration: none;
}

.ghost-link:hover {
  border-color: rgba(255, 66, 87, 0.5);
}

.ghost-button:hover, .filter:hover, .icon-button:hover { border-color: rgba(255, 66, 87, 0.5); }
.icon-button { width: 38px; padding: 0; }
.danger { color: #ff7a88; }

.danger-button {
  border-color: rgba(255, 66, 87, 0.45);
  color: #ff98a3;
}

.danger-button:hover {
  border-color: rgba(255, 66, 87, 0.8);
  background: rgba(255, 66, 87, 0.14);
}

.trash-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  color: #ff7a88;
}

.trash-button:hover { border-color: rgba(255, 66, 87, 0.65); background: rgba(227, 27, 53, 0.12); }
.trash-button svg { width: 18px; height: 18px; fill: currentColor; }

.view { display: none; }
.view.active { display: block; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.metric-card, .panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)), var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 16px;
  min-height: 128px;
}

.metric-card strong {
  display: block;
  margin: 12px 0 6px;
  font-size: 30px;
}

.metric-card.accent {
  border-color: rgba(227, 27, 53, 0.6);
  background: linear-gradient(145deg, rgba(227, 27, 53, 0.28), rgba(17, 19, 24, 0.96));
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(300px, 0.8fr);
  gap: 14px;
}

.panel { padding: 18px; min-width: 0; }
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.panel-header p { margin-bottom: 0; }
.split { align-items: center; }

.task-list, .message-list, .performance-list, .quick-replies {
  display: grid;
  gap: 10px;
}

.task-row {
  width: 100%;
  min-height: 72px;
  justify-content: space-between;
  background: var(--panel-2);
  border-color: var(--line);
}

.task-row div { flex: 1; min-width: 0; }
.task-icon.red { background: rgba(227, 27, 53, 0.22); color: #ff7584; }

.highlight-post {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  background: #0d0f13;
  border: 1px solid var(--line);
}

.post-type {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  color: white;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.post-type.post { background: var(--blue); }
.post-type.story { background: var(--amber); color: #171100; }
.post-type.reel { background: var(--red); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.filter.active {
  border-color: rgba(255, 66, 87, 0.7);
  background: rgba(227, 27, 53, 0.18);
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.day-column {
  min-height: 520px;
  background: #0b0d10;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
}

.day-column.drag-over {
  outline: 2px solid var(--red-2);
  outline-offset: 2px;
}

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.day-head strong { font-size: 14px; }
.day-head span { color: var(--muted); font-size: 12px; }

.post-card {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.post-card[draggable="true"] { cursor: grab; }
.post-card.archived { opacity: 0.48; }
.post-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: 12px; }
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
}

.status-pill.scheduled {
  border-color: rgba(255, 66, 87, 0.5);
  background: rgba(227, 27, 53, 0.16);
  color: #ff98a3;
}

.status-pill.publishing {
  border-color: rgba(255, 190, 92, 0.42);
  background: rgba(255, 190, 92, 0.13);
  color: #ffd08a;
}

.status-pill.published {
  border-color: rgba(47, 214, 127, 0.45);
  background: rgba(47, 214, 127, 0.14);
  color: #7af0ad;
}

.status-pill.draft {
  border-color: rgba(162, 170, 184, 0.32);
  background: rgba(162, 170, 184, 0.12);
  color: #c2c8d2;
}
.post-card strong { line-height: 1.25; }
.post-error {
  margin: 0;
  padding: 7px 8px;
  color: #ff9aa5;
  background: rgba(227, 27, 53, 0.12);
  border: 1px solid rgba(255, 66, 87, 0.28);
  border-radius: 7px;
  font-size: 12px;
}
.post-actions { display: flex; gap: 6px; align-items: center; }
.post-actions .ghost-button { flex: 1; min-height: 34px; padding: 0 8px; }

.media-preview {
  width: 100%;
  aspect-ratio: 1.1;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #0c0e12;
}

.media-preview.placeholder {
  display: grid;
  place-items: center;
  gap: 6px;
  padding: 12px;
  text-align: center;
}

.media-preview.placeholder span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(227, 27, 53, 0.18);
  color: #ff7a88;
  font-weight: 900;
}

.media-stack {
  position: relative;
}

.media-stack video {
  display: block;
}

.reel-thumbnail {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 42px;
  height: 42px;
  object-fit: cover;
  border: 2px solid #0b0d10;
  border-radius: 7px;
}

.badge {
  padding: 3px 7px;
  border-radius: 999px;
  background: #262a34;
  color: var(--muted);
  font-size: 12px;
}

.performance-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.inbox-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 14px;
}

.unread-panel, .conversation-panel { min-height: 650px; }

.message-item {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  text-align: left;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.message-item.unread {
  border-color: rgba(255, 66, 87, 0.55);
  background: rgba(227, 27, 53, 0.14);
}

.message-item.unread strong {
  color: #ff98a3;
}

.message-item.active, .message-item:hover {
  border-color: rgba(255, 66, 87, 0.55);
  background: rgba(227, 27, 53, 0.12);
}

.message-unread-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--red);
  vertical-align: middle;
}

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), #2b1016);
  font-weight: 900;
}

.message-item p, .performance-row p { margin: 3px 0 0; color: var(--muted); }
.message-item small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.conversation-panel {
  display: flex;
  flex-direction: column;
}

.conversation-history {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 320px;
  max-height: 430px;
  overflow-y: auto;
  padding: 12px;
  background: #0b0d10;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.chat-bubble {
  width: fit-content;
  max-width: min(620px, 82%);
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.chat-bubble.sent {
  align-self: flex-end;
  background: rgba(227, 27, 53, 0.18);
  border-color: rgba(255, 66, 87, 0.45);
}

.chat-bubble p { margin-bottom: 5px; color: var(--text); }
.chat-bubble span { color: var(--muted); font-size: 12px; }

.reply-box {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  margin: 12px 0 16px;
}

h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.empty-state {
  margin: 0;
  padding: 12px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.quick-replies button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  padding: 12px;
  text-align: left;
}

.donut {
  width: 190px;
  max-width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 12px auto 18px;
  border-radius: 50%;
  background: conic-gradient(var(--red) 0 100%);
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: var(--panel);
}

.donut span {
  position: relative;
  z-index: 1;
  font-size: 28px;
  font-weight: 900;
}

.legend { display: flex; justify-content: center; gap: 16px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }
.legend .ig { background: var(--red); }

dialog {
  width: min(720px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.post-dialog {
  width: min(1060px, calc(100vw - 28px));
}

.confirm-dialog {
  width: min(460px, calc(100vw - 28px));
}

dialog::backdrop { background: rgba(0, 0, 0, 0.68); backdrop-filter: blur(6px); }
.post-form, .post-form label { display: grid; gap: 8px; }
.post-form { gap: 16px; }
.dialog-header, .dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.composer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.composer-fields {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.02);
}

.form-grid, .media-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0c0e12;
  color: var(--text);
  padding: 11px 12px;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(255, 66, 87, 0.22);
  border-color: rgba(255, 66, 87, 0.52);
}

textarea { resize: vertical; }

.instagram-preview {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #07080b;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-header strong,
.preview-header small {
  display: block;
}

.preview-media {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 5;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0d1015;
  color: var(--muted);
}

.preview-media img,
.preview-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.preview-actions {
  display: flex;
  gap: 10px;
}

.preview-actions span {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.instagram-preview p {
  margin: 0;
  line-height: 1.45;
}

.instagram-preview p span {
  color: var(--text);
}

fieldset {
  display: flex;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

.check { display: inline-flex !important; grid-auto-flow: column; align-items: center; width: auto; }
.check input { width: auto; accent-color: var(--red); }

.admin-shell {
  min-height: 100vh;
  padding: 26px;
}

.admin-app {
  max-width: 1420px;
  margin: 0 auto;
}

.admin-form {
  display: grid;
  gap: 12px;
}

.admin-form label {
  display: grid;
  gap: 8px;
}

.club-list {
  display: grid;
  gap: 10px;
}

.club-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.club-row p {
  margin: 4px 0;
}

.club-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }
  .nav-list { display: flex; }
  .metric-grid, .content-grid { grid-template-columns: 1fr 1fr; }
  .inbox-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .composer-layout { grid-template-columns: 1fr; }
  .instagram-preview { max-width: 360px; }
  .topbar { align-items: stretch; flex-direction: column; }
  .topbar-actions { flex-wrap: wrap; }
}

@media (max-width: 680px) {
  .main-panel { padding: 16px; }
  .sidebar { padding: 14px; }
  .brand div, .nav-item span:last-child { display: none; }
  .metric-grid, .content-grid, .form-grid, .media-fields, .inbox-layout, .reply-box { grid-template-columns: 1fr; }
  .instagram-preview { max-width: none; }
  .unread-panel, .conversation-panel { min-height: auto; }
  .panel-header.split { align-items: stretch; flex-direction: column; }
  .filters { justify-content: flex-start; }
  .performance-row { grid-template-columns: 42px 1fr; }
  .performance-row .badge { grid-column: 2; width: fit-content; }
  .club-row { grid-template-columns: 1fr; }
  .club-actions { justify-content: flex-start; }
}
