@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap');

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

:root {
  --bg: #FFFFFF;
  --text: #1A1A1A;
  --muted: #8A8A8A;
  --border: #E8E8E8;
  --sidebar-bg: #F5F5F5;
  --active-bg: #1A1A1A;
  --active-text: #FFFFFF;
  --pill-bg: #EFEFEF;
  --pill-text: #3A3A3A;
  --overdue: #C0C0C0;
  --radius: 12px;
  --sidebar-width: 220px;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  padding: calc(24px + env(safe-area-inset-top, 0px)) 0 16px;
}

#sidebar-header {
  padding: 0 16px 24px;
  border-bottom: 1px solid var(--border);
}

#sidebar-header h1 {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
}

#sidebar-header p {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

#client-list {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.client-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.1s;
  user-select: none;
}

.client-item:hover {
  background: var(--border);
}

.client-item.active {
  background: var(--active-bg);
  color: var(--active-text);
}

.client-item .client-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.client-item.active .client-dot {
  background: #ffffff55;
}

.client-item .client-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

.client-item.active .client-count {
  color: #ffffff88;
}

#add-client-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  margin: 0 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--muted);
  transition: color 0.1s, background 0.1s;
  user-select: none;
  background: none;
  border: none;
  width: calc(100% - 16px);
  text-align: left;
  font-family: inherit;
}

#add-client-btn:hover {
  background: var(--border);
  color: var(--text);
}

#sidebar-footer {
  padding: 12px 16px 0;
  border-top: 1px solid var(--border);
}

/* ── Main content ── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Top bar ── */
#top-bar {
  padding: calc(20px + env(safe-area-inset-top, 0px)) 28px 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#top-bar-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}

#client-title {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
}

#client-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

#new-post-btn {
  padding: 8px 16px;
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.1s;
}

#new-post-btn:hover {
  opacity: 0.8;
}

/* ── Filter bar ── */
#filter-bar {
  display: flex;
  gap: 4px;
  padding-bottom: 0;
}

.filter-btn {
  padding: 6px 14px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.1s;
}

.filter-btn:hover {
  color: var(--text);
}

.filter-btn.active {
  color: var(--text);
  border-bottom-color: var(--text);
  font-weight: 500;
}

/* ── Queue ── */
#queue-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}

#post-queue {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 760px;
}

/* ── Empty state ── */
#empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
}

#empty-state p {
  font-size: 14px;
  line-height: 1.6;
}

#empty-state .empty-icon {
  font-size: 32px;
  margin-bottom: 16px;
  opacity: 0.3;
}

/* ── Checkbox label ── */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  accent-color: var(--text);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Boosted pill on card ── */
.pill-boosted {
  background: var(--text);
  color: var(--bg);
  font-size: 10px;
  letter-spacing: 0.02em;
}

/* ── Add-type button + inline input ── */
.pill-add-type {
  padding: 5px 10px;
  border: 1px dashed var(--border);
  border-radius: 100px;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.1s, color 0.1s;
  line-height: 1;
}

.pill-add-type:hover {
  border-color: var(--text);
  color: var(--text);
}

.pill-input {
  padding: 4px 10px;
  border: 1px solid var(--text);
  border-radius: 100px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  width: 100px;
}

/* ── Post card ── */
.post-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.1s;
}

.post-card:hover {
  border-color: #ccc;
}

.post-card.status-posted {
  opacity: 0.5;
}

.post-thumb {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--pill-bg);
  border: 1px solid var(--border);
}

.post-thumb-placeholder {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  background: var(--pill-bg);
  border: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 20px;
}

.post-body {
  flex: 1;
  min-width: 0;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  background: var(--pill-bg);
  color: var(--pill-text);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.post-caption {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.post-caption.empty {
  color: var(--muted);
  font-style: italic;
}

.post-footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.post-time {
  font-size: 12px;
  color: var(--muted);
}

.post-countdown {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.post-countdown.urgent {
  color: var(--text);
  background: var(--text);
  color: var(--bg);
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
}

.post-countdown.overdue {
  color: var(--overdue);
}

.post-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.mark-posted-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.1s, background 0.1s;
}

.mark-posted-btn:hover {
  border-color: var(--text);
}

.mark-posted-btn.posted {
  background: var(--pill-bg);
  color: var(--muted);
  border-color: var(--border);
}

.delete-btn {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.1s, color 0.1s;
}

.delete-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

/* ── Modal overlay ── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

#modal-overlay.open {
  display: flex;
}

#modal {
  background: var(--bg);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
}

#modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
}

#modal-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

#modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

#modal-close:hover {
  background: var(--pill-bg);
  color: var(--text);
}

#modal-body {
  padding: 20px 24px 24px;
}

/* ── Form elements ── */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: lowercase;
  letter-spacing: 0;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.1s;
  -webkit-appearance: none;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--text);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

.caption-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.caption-copy-btn {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.caption-copy-btn:hover { color: var(--text); border-color: var(--text); }

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

.form-row .form-group {
  flex: 1;
}

/* ── Pill toggle group ── */
.pill-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pill-toggle {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--bg);
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.1s;
  -webkit-appearance: none;
}

.pill-toggle:hover {
  border-color: var(--text);
  color: var(--text);
}

.pill-toggle.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ── Thumbnail upload ── */
#thumb-upload-area {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.1s;
}

#thumb-upload-area:hover {
  border-color: var(--text);
}

#thumb-preview {
  max-width: 120px;
  max-height: 120px;
  border-radius: 8px;
  object-fit: cover;
  display: none;
  margin: 0 auto 8px;
}

#thumb-upload-label {
  font-size: 12px;
  color: var(--muted);
  display: block;
}

#thumb-file-input {
  display: none;
}

/* ── Modal footer ── */
#modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--bg);
}

.btn-secondary {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.1s;
}

.btn-secondary:hover {
  border-color: var(--text);
}

.btn-primary {
  padding: 8px 16px;
  border: 1px solid var(--text);
  border-radius: 8px;
  background: var(--text);
  color: var(--bg);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.1s;
}

.btn-primary:hover {
  opacity: 0.8;
}

/* ── Client modal ── */
#client-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

#client-modal-overlay.open {
  display: flex;
}

#client-modal {
  background: var(--bg);
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  border: 1px solid var(--border);
  padding: 24px;
}

#client-modal h2 {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 16px;
}

.client-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* ── No client selected ── */
#no-client-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
  padding: 40px;
}

#no-client-view p {
  font-size: 14px;
  line-height: 1.6;
  max-width: 280px;
}

/* ── Toast ── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 200;
  transition: transform 0.2s ease;
  white-space: nowrap;
}

#toast.show {
  transform: translateX(-50%) translateY(0);
}

/* ── Top bar icon buttons ── */
.topbar-icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  color: var(--muted);
  transition: color 0.1s, border-color 0.1s, background 0.1s;
  flex-shrink: 0;
}

.topbar-icon-btn:hover,
.topbar-icon-btn.active {
  color: var(--text);
  border-color: var(--text);
  background: var(--pill-bg);
}

/* ── Ideas view ── */
#ideas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

#ideas-subject-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.ideas-filter-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.ideas-filter-btn:hover { border-color: var(--text); color: var(--text); }
.ideas-filter-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }

#ideas-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

#ideas-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

#ideas-empty {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
}

.idea-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.idea-card:hover {
  border-color: var(--text);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.idea-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.idea-card-title {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  flex: 1;
}

.idea-card-date {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
  margin-top: 1px;
}

.idea-card-subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.idea-subject-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--pill-bg);
  color: var(--muted);
  border: 1px solid var(--border);
}

.idea-card-notes {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.idea-card-links-count {
  font-size: 11px;
  color: var(--muted);
}

/* ── Idea modal ── */
#idea-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 110;
  padding: 16px;
}

#idea-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#idea-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#idea-modal-title {
  font-size: 15px;
  font-weight: 600;
}

#idea-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
}

#idea-modal-close:hover { background: var(--pill-bg); color: var(--text); }

#idea-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#idea-add-subject-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

#idea-add-subject-row .form-input { flex: 1; }

#idea-add-link-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

#idea-add-link-row .btn-primary { align-self: flex-start; }

.ideas-link-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
}

.ideas-link-item a {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ideas-link-item a:hover { text-decoration: underline; }

.ideas-link-delete {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
}

.ideas-link-delete:hover { color: var(--text); background: var(--pill-bg); }

#idea-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.btn-danger {
  background: none;
  border: 1px solid var(--border);
  color: #e05252;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}

.btn-danger:hover { background: rgba(224,82,82,0.08); border-color: #e05252; }

@media (max-width: 600px) {
  #ideas-grid { grid-template-columns: 1fr; }
  #ideas-toolbar { padding: 10px 14px; }
  #ideas-grid-wrap { padding: 14px; }
  #idea-modal { max-height: 95vh; border-radius: 12px; }
}

/* ── Calendar ── */
#calendar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 28px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#cal-prev, #cal-next {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s;
}

#cal-prev:hover, #cal-next:hover { background: var(--pill-bg); }

#cal-title {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
}

#cal-view-toggle {
  display: flex;
  gap: 4px;
}

.cal-view-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.1s;
}

.cal-view-btn.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

#calendar-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 16px 28px 24px;
}

/* Month grid */
.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.cal-day-header {
  background: var(--sidebar-bg);
  padding: 6px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cal-day-cell {
  background: var(--bg);
  min-height: 72px;
  padding: 6px;
  cursor: pointer;
  transition: background 0.1s;
}

.cal-day-cell:hover { background: var(--sidebar-bg); }

.cal-day-cell.other-month { opacity: 0.35; }

.cal-day-cell.today .cal-day-num {
  background: var(--text);
  color: var(--bg);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-day-num {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text);
  opacity: 0.6;
}

.cal-dot.posted { opacity: 0.2; }

/* Week grid */
.cal-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

@media (max-width: 600px) {
  .cal-week-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  #calendar-controls {
    padding: 12px 16px 10px;
  }

  #calendar-grid-wrap {
    padding: 12px 16px 24px;
  }
}

.cal-week-col {
  min-width: 0;
}

.cal-week-day-header {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.cal-week-day-header.today { color: var(--text); }

.cal-week-post {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 4px;
  cursor: pointer;
  transition: border-color 0.1s;
}

.cal-week-post:hover { border-color: #bbb; }

.cal-week-post .cal-post-time {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 2px;
}

.cal-week-post .cal-post-caption {
  font-size: 11px;
  color: var(--text);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cal-week-post .cal-post-platform {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}

.cal-empty-day {
  font-size: 11px;
  color: var(--border);
  padding: 4px 0;
}

/* ── Auth overlay ── */
#auth-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}

#auth-overlay.open {
  display: flex;
}

#auth-card {
  width: 100%;
  max-width: 360px;
}

#auth-skip {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  padding: 6px;
}

#auth-skip:hover { color: var(--text); }

#sync-status-btn {
  display: block;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 6px 0 0;
  text-align: left;
  transition: color 0.1s;
}

#auth-card h2 {
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

#auth-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

#auth-error {
  font-size: 12px;
  color: #c0392b;
  min-height: 18px;
  margin-top: 6px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ── Hamburger menu button ── */
.menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text);
  flex-shrink: 0;
  font-family: inherit;
  transition: background 0.1s;
}

.menu-btn:hover {
  background: var(--pill-bg);
}

#menu-btn-empty {
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  gap: 6px;
}

/* ── Sidebar backdrop ── */
#sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 49;
}

#sidebar-backdrop.visible {
  display: block;
}

/* ── Mobile / narrow ── */
@media (max-width: 600px) {
  .menu-btn {
    display: flex;
  }

  #sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #top-bar {
    padding: calc(16px + env(safe-area-inset-top, 0px)) 16px 0;
  }

  #queue-wrapper {
    padding: 16px;
  }

  .post-card {
    flex-wrap: wrap;
  }

  #no-client-view {
    padding-top: 40px;
  }
}

/* ── Vault ── */
#vault-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

#vault-category-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}

.vault-filter-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.vault-filter-btn:hover { border-color: var(--text); color: var(--text); }
.vault-filter-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }

#vault-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

#vault-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

#vault-empty {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
}

.vault-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s;
}

.vault-card:hover { border-color: var(--text); }

.vault-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
}

.vault-card-label {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}

.vault-cat-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--muted);
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.vault-cat-badge.social  { border-color: #6c8ebf; color: #6c8ebf; }
.vault-cat-badge.email   { border-color: #d6853a; color: #d6853a; }
.vault-cat-badge.website { border-color: #5a9e6f; color: #5a9e6f; }

.vault-card-username {
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.vault-card-actions {
  display: flex;
  gap: 6px;
}

.vault-card-copy-btn {
  flex: 1;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: none;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}

.vault-card-copy-btn:hover { color: var(--text); border-color: var(--text); }

/* Vault unlock overlay */
#vault-unlock-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 150;
  padding: 16px;
}

#vault-unlock-overlay.open { display: flex; }

#vault-unlock-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px 24px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}

.vault-lock-icon-big { font-size: 36px; margin-bottom: 12px; }

#vault-unlock-heading {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 6px;
}

#vault-unlock-desc {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.5;
}

#vault-unlock-error {
  font-size: 12px;
  color: #e05252;
  min-height: 18px;
  margin-top: 6px;
}

#vault-unlock-cancel {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
}

#vault-unlock-cancel:hover { color: var(--text); }

/* Vault entry modal */
#vault-entry-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 160;
  padding: 16px;
}

#vault-entry-overlay.open { display: flex; }

#vault-entry-modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#vault-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#vault-entry-title { font-size: 15px; font-weight: 600; }

#vault-entry-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 6px;
  border-radius: 4px;
}

#vault-entry-close:hover { background: var(--pill-bg); color: var(--text); }

#vault-entry-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.vault-field-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.vault-field-row .form-input { flex: 1; }

.vault-util-btn {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.vault-util-btn:hover { color: var(--text); border-color: var(--text); }

.vault-copy-btn {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
}

.vault-copy-btn:hover { color: var(--text); border-color: var(--text); }

#vault-entry-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

@media (max-width: 600px) {
  #vault-grid { grid-template-columns: 1fr; }
  #vault-toolbar { padding: 10px 14px; }
  #vault-grid-wrap { padding: 14px; }
  #vault-entry-modal { max-height: 95vh; border-radius: 12px; }
}

/* ── Docs hub ── */
#docs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#docs-cat-filter {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.docs-filter-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.docs-filter-btn:hover { border-color: var(--text); color: var(--text); }
.docs-filter-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }

#docs-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

#docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

#docs-empty {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
}

.doc-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.1s;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.doc-card:hover { border-color: #ccc; }

.doc-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.doc-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.doc-card-date {
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}

.doc-cat-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  align-self: flex-start;
}

.doc-cat-caption { background: #fef3c7; color: #92400e; }
.doc-cat-brief   { background: #dbeafe; color: #1d4ed8; }
.doc-cat-brand   { background: #fce7f3; color: #be185d; }
.doc-cat-contract { background: #dcfce7; color: #15803d; }
.doc-cat-other   { background: var(--pill-bg); color: var(--pill-text); }

.doc-card-preview {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Doc modal */
#doc-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 110;
  padding: 20px;
}

#doc-modal-overlay.open { display: flex; }

#doc-modal {
  background: var(--bg);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

#doc-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}

#doc-modal-title { font-size: 15px; font-weight: 600; }

#doc-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

#doc-modal-close:hover { background: var(--pill-bg); color: var(--text); }

#doc-modal-body { padding: 20px; flex: 1; overflow-y: auto; }

#doc-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Links hub ── */
#links-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#links-toolbar-top {
  display: flex;
  gap: 8px;
  align-items: center;
}

#links-toolbar-top .form-input {
  flex: 1;
  padding: 8px 12px;
}

#links-cat-filter {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.links-filter-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.links-filter-btn:hover { border-color: var(--text); color: var(--text); }
.links-filter-btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }

#links-grid-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

#links-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

#links-empty {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--muted);
  text-align: center;
}

.link-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.1s;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.link-card:hover { border-color: #ccc; }

.link-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.link-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}

.link-cat-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: capitalize;
}

.lcat-pink   { background: #fce7f3; color: #be185d; }
.lcat-blue   { background: #dbeafe; color: #1d4ed8; }
.lcat-green  { background: #dcfce7; color: #15803d; }
.lcat-purple { background: #ede9fe; color: #7c3aed; }
.lcat-gray   { background: var(--pill-bg); color: var(--pill-text); }

.link-card-url {
  font-size: 11px;
  color: var(--muted);
}

.link-card-notes {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

.link-card-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.link-open-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 11px;
  font-family: inherit;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.1s;
}

.link-open-btn:hover { border-color: var(--text); }

.link-copy-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: none;
  font-size: 11px;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.1s;
}

.link-copy-btn:hover { color: var(--text); border-color: var(--text); }

/* Link modal */
#link-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 110;
  padding: 20px;
}

#link-modal-overlay.open { display: flex; }

#link-modal {
  background: var(--bg);
  border-radius: 16px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

#link-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}

#link-modal-title { font-size: 15px; font-weight: 600; }

#link-modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}

#link-modal-close:hover { background: var(--pill-bg); color: var(--text); }

#link-modal-body { padding: 20px; flex: 1; }

#link-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

@media (max-width: 600px) {
  #docs-grid, #links-grid { grid-template-columns: 1fr; }
  #docs-toolbar, #links-toolbar { padding: 10px 14px; }
  #docs-grid-wrap, #links-grid-wrap { padding: 14px; }
}
