:root {
  color-scheme: dark;
  --bg: #070202;
  --bg-deep: #020000;
  --card: #2a0b0b;
  --card-strong: #351010;
  --card-edge: #3a1b1b;
  --text: #f7f3f3;
  --muted: #a89595;
  --accent: #d14343;
  --accent-soft: #7a1f1f;
  --warning: #e1b93a;
  --danger: #d85c5c;
  --shadow: rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 10%, rgba(209, 67, 67, 0.14), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(122, 31, 31, 0.2), transparent 40%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  color: var(--text);
  font-family: "Sora", sans-serif;
  letter-spacing: 0.01em;
  font-size: 15px;
}

a {
  color: var(--accent);
}

.bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 30% 80%, rgba(209, 67, 67, 0.12), transparent 45%);
  mix-blend-mode: screen;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 5vw 6px;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(7, 2, 2, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.topbar-logo {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.topbar-logo img {
  height: 34px;
  width: auto;
  opacity: 0.9;
}

body:not(.is-auth) .topbar-logo {
  position: static;
  transform: none;
  margin-left: auto;
}

body:not(.is-auth) .topbar-logo img {
  height: 54px;
}

.brand {
  display: grid;
  gap: 2px;
  font-weight: 600;
}

.brand-title {
  font-size: 1.1rem;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-smd {
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}

.brand-by {
  font-size: 0.9rem;
  font-style: italic;
  font-weight: 500;
}

.brand-subtitle {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.65rem;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ghost-btn {
  border: 1px solid var(--card-edge);
  background: transparent;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  transition: transform 0.2s ease, border 0.2s ease;
}

.ghost-btn:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--card-edge);
  background: var(--card);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease;
}

.icon-btn.small {
  width: 36px;
  height: 36px;
}

.icon-btn:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.hamburger {
  width: 18px;
  height: 2px;
  background: var(--text);
  position: relative;
}

.hamburger::before,
.hamburger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 18px;
  height: 2px;
  background: var(--text);
}

.hamburger::before {
  top: -6px;
}

.hamburger::after {
  top: 6px;
}

main {
  padding: 24px 5vw 60px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 20px 40px var(--shadow);
  animation: rise 0.5s ease both;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-search {
  min-width: 200px;
  max-width: 240px;
}

.panel-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel h1,
.panel h2,
.panel h3 {
  margin-top: 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-layout {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.form-field label {
  font-size: 0.9rem;
  color: var(--muted);
}

input,
textarea {
  background: #1c0b0b;
  border: 1px solid var(--card-edge);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  font-family: inherit;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.primary-btn {
  background: var(--accent);
  color: #120202;
  border: none;
  padding: 12px 18px;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.primary-btn.small {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.primary-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.open-media-btn {
  background: var(--accent);
  color: #120202;
  border: none;
}

.project-list {
  display: grid;
  gap: 18px;
}

.client-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.client-code {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.create-project {
  margin: 12px 0 18px;
  display: grid;
  gap: 12px;
}

.project-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--card-edge);
  background: rgba(25, 8, 8, 0.85);
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease;
}

.project-card.past {
  opacity: 0.55;
  filter: grayscale(0.4);
}

.project-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-soft);
}

.project-meta {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  font-size: 0.85rem;
}

.project-info {
  display: grid;
  gap: 4px;
}

.project-delete {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(215, 109, 95, 0.6);
  background: transparent;
  color: var(--danger);
  font-size: 1.1rem;
  cursor: pointer;
}

.project-delete:hover {
  background: rgba(215, 109, 95, 0.12);
}

.project-header {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.project-title {
  font-size: 1.4rem;
  font-weight: 600;
}

.project-subtitle {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
}

.project-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.entries {
  display: grid;
  gap: 12px;
}

.entry-card {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  padding: 14px;
  border-radius: 20px;
  border: 1px solid var(--card-edge);
  background: var(--card);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
  position: relative;
}

.entry-card.selectable {
  cursor: pointer;
}

.entry-card.active {
  border-color: var(--accent);
  border-width: 2px;
  box-shadow: 0 14px 34px rgba(62, 208, 136, 0.25);
}

.entry-card.drag-over {
  border-color: var(--accent-soft);
  box-shadow: 0 12px 30px rgba(62, 208, 136, 0.12);
}

.entry-card.past {
  opacity: 0.55;
  filter: grayscale(0.3);
}

.entry-handle {
  align-self: center;
  width: 20px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--card-edge);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  cursor: grab;
}

.entry-handle::before {
  content: "";
  width: 10px;
  height: 12px;
  background: repeating-linear-gradient(
    to bottom,
    rgba(244, 247, 245, 0.8),
    rgba(244, 247, 245, 0.8) 2px,
    transparent 2px,
    transparent 4px
  );
}

.entry-body {
  display: grid;
  gap: 12px;
}

.entry-content {
  position: relative;
}

.entry-content::after {
  content: "";
  display: block;
  clear: both;
}

.entry-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--muted);
}

.entry-meta-row .pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--card-edge);
  background: rgba(0, 0, 0, 0.25);
}

.entry-media {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--card-edge);
  background: #140707;
  cursor: pointer;
  float: right;
  width: 140px;
  margin: 2px 0 8px 12px;
}

.entry-media img,
.entry-media video {
  width: 100%;
  display: block;
  max-height: 90px;
  object-fit: contain;
  background: #080303;
}

.entry-media .audio-pill {
  padding: 16px;
  font-family: "IBM Plex Mono", monospace;
  color: var(--accent);
}

.entry-text {
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 0.9rem;
}

.entry-text p {
  margin: 0 0 6px;
}

.entry-text ul,
.entry-text ol {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.entry-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.entry-footer.view {
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 10px;
}

.entry-footer.edit {
  align-items: center;
  justify-content: space-between;
}

.entry-actions {
  display: flex;
  gap: 8px;
}

.entry-actions.right {
  margin-left: auto;
  justify-content: flex-end;
}

.action-btn {
  border-radius: 50%;
  width: 36px;
  height: 36px;
  background: rgba(12, 30, 20, 0.95);
  border: 1px solid var(--card-edge);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.action-btn svg {
  width: 16px;
  height: 16px;
  fill: var(--text);
}

.action-btn.danger {
  border-color: rgba(215, 109, 95, 0.6);
}

.action-btn.danger svg {
  fill: var(--danger);
}

.entry-controls {
  display: grid;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--accent);
  background: rgba(8, 3, 3, 0.7);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  min-width: 220px;
}

.media-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.entry-controls button {
  border: 1px solid var(--card-edge);
  background: transparent;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.volume-wrap input[type="range"] {
  width: 90px;
}

.media-progress {
  cursor: pointer;
}

.media-progress {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.media-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s linear;
}

.upload-progress {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
  color: var(--muted);
}

.upload-progress.active {
  display: flex;
}

.upload-progress-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s linear;
}

.rich-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.rich-toolbar button {
  border: 1px solid var(--card-edge);
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
}

.rich-editor {
  min-height: 110px;
  border: 1px solid var(--card-edge);
  border-radius: 12px;
  padding: 10px 12px;
  background: #1c0b0b;
  color: var(--text);
}

.media-options {
  display: none;
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--card-edge);
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.85rem;
}

.media-options.open {
  display: grid;
  gap: 8px;
}

.media-options-header {
  font-family: "IBM Plex Mono", monospace;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.media-option {
  display: flex;
  align-items: center;
  gap: 8px;
}

.media-option-input input {
  width: 120px;
}

.media-option-input.hidden {
  display: none;
}

.entry-add {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 48px;
}

.entry-add button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px dashed var(--card-edge);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.entry-add button svg {
  width: 16px;
  height: 16px;
  fill: var(--text);
}

.entry-edit {
  display: grid;
  gap: 12px;
}

.entry-edit .row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.entry-edit .note {
  color: var(--muted);
  font-size: 0.85rem;
}

.menu-panel {
  position: fixed;
  top: 90px;
  right: 6vw;
  width: min(300px, 80vw);
  background: var(--card-strong);
  border: 1px solid var(--card-edge);
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 16px 30px var(--shadow);
  z-index: 20;
}

.menu-panel.hidden {
  display: none;
}

.menu-panel button {
  width: 100%;
  margin-bottom: 10px;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--card);
  border: 1px solid var(--card-edge);
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: 0 10px 24px var(--shadow);
}

.toast.hidden {
  display: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--card-edge);
  background: rgba(0, 0, 0, 0.25);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
}

.export-badge {
  gap: 10px;
}

.export-delete {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(215, 109, 95, 0.6);
  background: transparent;
  color: var(--danger);
  font-size: 0.95rem;
  cursor: pointer;
  line-height: 1;
}

.export-delete:hover {
  background: rgba(215, 109, 95, 0.12);
}

body:not(.is-client) .top-actions {
  display: none;
}

.admin-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.admin-card h3 {
  margin-top: 0;
}

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

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-row.selectable {
  cursor: pointer;
}

.admin-row.selected {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 10px;
}

.admin-card.full {
  grid-column: 1 / -1;
}

.admin-row:last-child {
  border-bottom: none;
}

.admin-title {
  font-weight: 600;
}

.admin-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--muted);
}

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

.admin-action {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--card-edge);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.admin-pill {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--card-edge);
  background: transparent;
  color: var(--text);
  font-size: 0.75rem;
  cursor: pointer;
}

.admin-pill:hover {
  border-color: var(--accent);
}

.admin-action.danger {
  border-color: rgba(215, 109, 95, 0.6);
  color: var(--danger);
}

.admin-link {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.empty-state {
  border: 1px dashed var(--card-edge);
  padding: 24px;
  border-radius: 20px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 720px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .entry-card {
    grid-template-columns: 1fr;
  }

  .entry-handle {
    display: none;
  }

  .entry-add {
    padding-left: 0;
  }
}
