:root {
  color-scheme: dark;
  --bg: #141518;
  --panel: #1d1f23;
  --panel-2: #25282e;
  --line: #cfd3dc;
  --muted-line: #3b414b;
  --text: #f8f9fb;
  --muted: #9aa6bd;
  --accent: #28d47e;
  --accent-2: #52b6ff;
  --accent-soft: #baf2d5;
  --danger: #ff3d73;
  --warning: #f9c846;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --shadow-soft: 0 12px 26px rgba(0, 0, 0, 0.22);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
.note-item,
.modal-panel,
.editor,
.date-display,
select,
input,
textarea {
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.hidden {
  display: none !important;
}

.setup,
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #17181c;
}

.setup-panel,
.auth-panel {
  width: min(440px, 100%);
  border: 1px solid var(--muted-line);
  background: var(--panel);
  padding: 28px;
  box-shadow: var(--shadow);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-mark,
.logo {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 200, 46, 0.58);
  background: #070707;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28), 0 0 0 3px rgba(255, 196, 31, 0.08);
  border-radius: 8px;
  overflow: hidden;
}

.brand-mark img,
.logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  transform: scale(1.12);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 12px;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 28px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
  color: #d7d9e0;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--muted-line);
  background: #14161a;
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
}

.auth-form input {
  height: 46px;
  padding: 0 14px;
}

.primary-button,
.ghost-button,
.new-note-button,
.danger-button {
  min-height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  color: var(--text);
  font-weight: 800;
  background: #1f2227;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #102016;
}

.ghost-button:hover,
.new-note-button:hover {
  border-color: var(--accent);
}

.danger-button {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.message {
  min-height: 20px;
  margin: 0;
  color: var(--warning);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 228px 388px minmax(0, 1fr);
  background:
    linear-gradient(90deg, rgba(40, 212, 126, 0.04), transparent 42%),
    var(--bg);
}

.nav {
  border-right: 1px solid var(--line);
  background: #17191f;
  padding: 14px 18px;
}

.store-header {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 66px;
  border-bottom: 1px solid rgba(40, 212, 126, 0.78);
  margin-bottom: 28px;
}

.store-title {
  display: grid;
  gap: 3px;
}

.store-title small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.logo {
  width: 42px;
  height: 42px;
}

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  text-align: left;
  border-radius: 8px;
  padding: 0 12px;
  transition: background 140ms ease, color 140ms ease;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-link svg,
.search-box svg,
.icon-button svg {
  width: 20px;
  height: 20px;
}

.notes-column {
  display: grid;
  grid-template-rows: 82px auto 72px minmax(0, 1fr);
  border-right: 1px solid var(--line);
  background: #1f2228;
  min-width: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  color: #8290ab;
}

.search-box input {
  height: 46px;
  border: 0;
  background: transparent;
  font-size: 18px;
}

.new-note-button {
  align-self: center;
  justify-self: center;
  width: calc(100% - 22px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.notes-tools {
  display: grid;
  gap: 10px;
  padding: 12px 12px 8px;
  border-bottom: 1px solid var(--muted-line);
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.stats-bar span {
  min-width: 0;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  background: rgba(12, 14, 18, 0.34);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.stats-bar strong {
  display: block;
  color: var(--text);
  font-size: 16px;
}

.filter-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.filter-tab {
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid var(--muted-line);
  border-radius: 999px;
  background: #171a20;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  padding: 0 11px;
}

.filter-tab.active,
.filter-tab:hover {
  border-color: rgba(40, 212, 126, 0.66);
  background: rgba(40, 212, 126, 0.12);
  color: var(--text);
}

.platform-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
}

.quick-mode .platform-filter-row,
.quick-mode .template-field {
  display: none;
}

.quick-mode .editor-options {
  display: block;
}

.quick-mode .editor-options label {
  width: 100%;
}

.platform-filter-row select {
  height: 42px;
  border-radius: 8px;
  padding: 0 10px;
}

.mini-tool-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--muted-line);
  border-radius: 8px;
  background: #171a20;
  color: var(--accent);
}

.mini-tool-button:hover {
  border-color: var(--accent);
  background: rgba(40, 212, 126, 0.1);
}

.mini-tool-button svg {
  width: 18px;
  height: 18px;
}

.notes-list {
  overflow: auto;
  border-top: 1px solid var(--muted-line);
}

.note-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  min-height: 108px;
  padding: 18px 22px 18px 24px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  color: #7e8dad;
  text-align: left;
  overflow: hidden;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.note-item::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: transparent;
}

.note-item.active {
  outline: 1px solid rgba(40, 212, 126, 0.72);
  outline-offset: -1px;
  box-shadow: inset 4px 0 0 var(--accent), inset 0 1px rgba(255, 255, 255, 0.04);
}

.note-item.active::before {
  background: var(--accent);
}

.note-item.template-netflix {
  background: #2a1114;
  color: #ff8c95;
}

.note-item.template-hbomax {
  background: #241639;
  color: #c6a4ff;
}

.note-item.template-primevideo {
  background: #102739;
  color: #86d6ff;
}

.note-item.template-disney {
  background: #10234a;
  color: #9fc0ff;
}

.note-item.template-disneypremium {
  background: #122b5d;
  color: #b8d1ff;
}

.note-item.template-crunchyroll {
  background: #331d10;
  color: #ffb06c;
}

.note-item.template-paramount {
  background: #101f3f;
  color: #9cc8ff;
}

.note-item.template-quick {
  background: #2b2414;
  color: #ffe08a;
}

.note-item.sold {
  background: var(--accent-soft);
  color: #40516a;
}

.note-item.archived {
  background: #1b1d22;
  color: #788294;
}

.note-item.pending {
  background: #2b281c;
  color: #e9c760;
}

.note-item.problem,
.note-item.expired {
  background: #2a1b22;
  color: #ff86a8;
}

.note-item.soon {
  background: #26281d;
  color: #e5d36b;
}

.note-item:hover {
  color: #d9e0ee;
  background: #272b32;
  transform: translateX(2px);
}

.note-item.sold:hover {
  color: #20324a;
  background: #aef0ce;
}

.note-item.template-netflix::before {
  background: #e50914;
}

.note-item.template-hbomax::before {
  background: #9b5cff;
}

.note-item.template-primevideo::before {
  background: #00a8e1;
}

.note-item.template-disney::before {
  background: #2b6cff;
}

.note-item.template-disneypremium::before {
  background: #4d8dff;
}

.note-item.template-crunchyroll::before {
  background: #f47521;
}

.note-item.template-paramount::before {
  background: #0064d2;
}

.note-item.template-quick::before {
  background: #f6c84f;
}

.note-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.note-title-row strong,
.note-item strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  align-self: end;
}

.platform-chip {
  flex: 0 0 auto;
  height: 21px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  font-weight: 900;
}

.note-meta {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.note-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(82, 182, 255, 0.16);
  color: #8bbfed;
  font-size: 12px;
  font-weight: 900;
}

.note-status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.note-item.sold .note-status {
  background: rgba(14, 124, 72, 0.12);
  color: #11663d;
}

.note-item.pending .note-status {
  background: rgba(249, 200, 70, 0.14);
  color: #ffd66e;
}

.note-item.problem .note-status,
.note-item.expired .note-status {
  background: rgba(255, 61, 115, 0.14);
  color: #ff9ab7;
}

.note-item.archived .note-status {
  background: rgba(154, 166, 189, 0.14);
  color: #aeb8ca;
}

.note-expiry {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  opacity: 0.88;
}

.note-date {
  color: inherit;
  font-size: 14px;
  opacity: 0.85;
}

.editor-shell {
  display: grid;
  grid-template-rows: 82px minmax(0, 1fr);
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 0 34px;
  background: rgba(20, 21, 24, 0.6);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 16px;
  font-weight: 800;
}

.avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffe08a, #f8b932);
  color: #5b382d;
  font-size: 24px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.editor {
  margin: 22px;
  border: 1px solid rgba(207, 211, 220, 0.72);
  background: linear-gradient(180deg, #25282d, #222529);
  box-shadow: var(--shadow-soft);
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto 56px minmax(0, 1fr) 34px;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.date-group,
.editor-options {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.date-group label,
.editor-options label {
  gap: 5px;
  min-width: 140px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.date-group input,
.editor-options select,
.date-display {
  height: 42px;
  padding: 0 12px;
  border-radius: 8px;
}

.date-group input,
.date-display {
  width: 150px;
}

.date-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--muted-line);
  background: #151820;
  color: var(--text);
  font-weight: 900;
}

.date-display:hover,
select:hover {
  border-color: rgba(40, 212, 126, 0.55);
  background: #181c24;
}

.date-display svg {
  width: 17px;
  height: 17px;
  color: #6d84ab;
}

.editor-options {
  padding: 10px 18px;
  border-bottom: 1px solid var(--muted-line);
  background: #202328;
}

.editor-options label {
  flex: 1;
}

#dateInput,
#expiresInput {
  height: 46px;
  padding: 0 14px;
  background: #f7f7f9;
  color: #6c758f;
  border: 0;
}

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

.action-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(12, 14, 18, 0.36);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 8px;
  background: #eef1f6;
  color: #71809d;
  transition: transform 140ms ease, background 140ms ease;
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

.icon-button:hover {
  transform: translateY(-1px);
  background: #ffffff;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.18);
}

.icon-button.success {
  color: #16ae59;
}

.icon-button.danger {
  color: var(--danger);
}

.icon-button.is-active {
  background: var(--accent);
  color: #122016;
}

.icon-button.copied {
  background: var(--accent);
  color: #102016;
  box-shadow: 0 0 0 4px rgba(40, 212, 126, 0.18);
}

.title-input {
  border: 0;
  border-bottom: 1px solid var(--muted-line);
  padding: 0 20px;
  background: #232528;
  color: var(--text);
  font-weight: 800;
  font-size: 18px;
}

.content-input {
  resize: none;
  border: 0;
  padding: 22px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    #232528;
  background-size: 100% 32px;
  color: var(--text);
  line-height: 1.45;
  font-weight: 650;
}

.content-input.sensitive-hidden {
  color: transparent;
  text-shadow: 0 0 9px rgba(248, 249, 251, 0.58);
}

.status-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 14px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--muted-line);
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 220px;
  padding: 30px;
  color: #9ca5b8;
  text-align: center;
}

.empty-state strong {
  color: var(--text);
  font-size: 18px;
}

.empty-state span {
  max-width: 240px;
  line-height: 1.35;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(40, 212, 126, 0.38);
  border-radius: 8px;
  background: rgba(40, 212, 126, 0.08);
  color: var(--accent);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 8, 10, 0.72);
  backdrop-filter: blur(4px);
}

.modal-panel {
  width: min(380px, 100%);
  border: 1px solid var(--muted-line);
  border-radius: 8px;
  background: linear-gradient(180deg, #24272d, #202328);
  padding: 24px;
  box-shadow: var(--shadow), inset 0 1px rgba(255, 255, 255, 0.04);
  animation: modalIn 150ms ease-out;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: rgba(255, 61, 115, 0.12);
  color: var(--danger);
}

.modal-panel h2 {
  margin: 16px 0 8px;
}

.modal-panel p {
  margin: 0 0 20px;
  color: var(--muted);
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.modal-cancel-link {
  width: 100%;
  min-height: 38px;
  margin-top: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.modal-cancel-link:hover {
  color: var(--text);
}

.date-modal-panel {
  width: min(460px, calc(100vw - 32px));
}

.custom-calendar {
  margin: 18px 0 24px;
  border: 1px solid var(--muted-line);
  border-radius: 8px;
  overflow: hidden;
  background: #171a20;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.03);
}

.calendar-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  min-height: 52px;
  padding: 0 10px;
  border-bottom: 1px solid var(--muted-line);
  background: #20242b;
}

.calendar-head strong {
  text-align: center;
  text-transform: capitalize;
}

.calendar-nav {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.calendar-nav:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.calendar-nav svg {
  width: 18px;
  height: 18px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  width: 100%;
}

.calendar-weekdays {
  padding: 12px 14px 6px;
  color: #8fa0be;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.calendar-weekdays span {
  display: block;
  min-width: 0;
}

.calendar-grid {
  gap: 6px;
  padding: 6px 14px 14px;
}

.calendar-day {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #202329;
  color: var(--text);
  font-weight: 850;
  padding: 0;
  text-align: center;
}

.calendar-day:hover {
  border-color: rgba(40, 212, 126, 0.72);
  background: #263038;
}

.calendar-day.muted-day {
  color: #596273;
  background: transparent;
}

.calendar-day.today-day {
  border-color: rgba(82, 182, 255, 0.72);
  color: #a8d8ff;
}

.calendar-day.selected-day {
  border-color: var(--accent);
  background: var(--accent);
  color: #102016;
}

.calendar-shortcuts {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 14px 14px;
}

.calendar-shortcuts button {
  min-height: 34px;
  border: 1px solid var(--muted-line);
  border-radius: 8px;
  background: #202329;
  color: var(--text);
  font-weight: 800;
  padding: 0 12px;
}

.calendar-shortcuts button:hover {
  border-color: var(--accent);
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 320px minmax(0, 1fr);
  }

  .nav {
    display: flex;
    align-items: center;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .store-header {
    width: auto;
    min-width: 150px;
    margin: 0;
    border-bottom: 0;
  }

  .nav-link {
    width: auto;
  }

  .notes-column {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .topbar {
    display: none;
  }

  .editor-shell {
    grid-template-rows: minmax(0, 1fr);
  }

  .editor {
    margin: 12px;
  }
}

@media (max-width: 560px) {
  .nav {
    flex-wrap: wrap;
  }

  .editor-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .toolbar-actions {
    width: 100%;
    gap: 8px;
    justify-content: flex-start;
  }

  .icon-button {
    width: 46px;
    height: 46px;
  }

  .date-group,
  .editor-options {
    flex-direction: column;
    align-items: stretch;
  }

  .date-group label,
  .editor-options label,
  .date-group input {
    width: 100%;
  }

  .editor {
    grid-template-rows: auto auto 56px minmax(0, 1fr) 34px;
  }

  .modal {
    align-items: start;
    padding: 12px;
    overflow: auto;
  }

  .modal-panel {
    padding: 18px;
  }

  .date-modal-panel {
    width: min(100%, 390px);
  }

  .calendar-head {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    min-height: 48px;
    padding: 0 8px;
  }

  .calendar-head strong {
    font-size: 15px;
  }

  .calendar-weekdays {
    padding: 10px 8px 5px;
    font-size: 11px;
  }

  .calendar-grid {
    gap: 4px;
    padding: 5px 8px 10px;
  }

  .calendar-day {
    height: 38px;
    border-radius: 7px;
    font-size: 14px;
  }

  .calendar-shortcuts {
    padding: 0 8px 10px;
  }

  .modal-actions {
    gap: 10px;
  }
}
