/* Noted — simple on-device to-do & notes organizer.
 * Self-contained styles, brand tokens from brand/colors.css. */

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text-primary);
  background: var(--page-bg);
}

/* ---------- header ---------- */
.n-header {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--divider);
  position: relative;
}
.n-switch-group { display: flex; gap: 8px; flex-wrap: wrap; }
.w-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid var(--brand-accent);
  border-radius: 8px;
  color: var(--brand-accent);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.w-switch:hover { background: rgba(192,70,46,.08); }
.btn-ico { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.n-brand { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.brand-logo { width: 30px; height: 30px; display: block; }
.brand-name { font-size: 21px; font-weight: 700; letter-spacing: .3px; }
.bn-ink { color: var(--inkso-ai); }
.bn-so { color: var(--inkso-ai-tint); }
.bn-tm { font-size: 11px; vertical-align: super; color: var(--inkso-ai-tint); }
.bn-suffix { color: var(--text-muted); font-weight: 600; margin-left: 6px; }

/* language dropdown (same pattern as the other tools) */
.lang-menu { position: relative; }
.lang-menu summary {
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none; color: var(--brand-primary); font-size: 14px;
  padding: 5px 11px; border: 1px solid var(--divider); border-radius: 8px; background: #fff;
}
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary::after { content: "▾"; font-size: 10px; }
.lang-menu summary:hover, .lang-menu[open] summary { background: var(--page-bg); }
.lang-menu nav {
  position: absolute; right: 0; top: calc(100% + 6px);
  display: flex; flex-direction: column; min-width: 130px; padding: 5px;
  background: #fff; border: 1px solid var(--divider); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.18); z-index: 60;
}
.lang-menu nav a { padding: 7px 11px; border-radius: 7px; font-size: 14px; color: var(--brand-primary); text-decoration: none; }
.lang-menu nav a:hover { background: var(--page-bg); }

.n-privacy {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  margin: 0; padding: 7px 14px;
  font-size: 12.5px; color: var(--text-muted);
  background: var(--page-bg);
  border-bottom: 1px solid var(--divider);
}
.n-privacy svg { fill: none; stroke: var(--inkso-ai); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- layout ---------- */
.n-main { display: flex; align-items: stretch; min-height: calc(100vh - 96px); }

/* ---------- sidebar (notebook list) ---------- */
.n-sidebar {
  flex: none;
  width: 214px;
  border-right: 1px solid var(--divider);
  background: var(--surface);
  padding: 12px 10px;
}
.n-side-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); padding: 4px 6px 10px;
}
.n-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--brand-accent); border-radius: 8px;
  background: transparent; color: var(--brand-accent); cursor: pointer;
}
.n-icon-btn:hover { background: var(--brand-accent); color: #fff; }
.n-icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.n-book-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.n-book {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 10px; border-radius: 9px; cursor: pointer;
  font-size: 14.5px; font-weight: 600; color: var(--text-primary);
}
.n-book:hover { background: var(--page-bg); }
.n-book.active { background: var(--inkso-ai); color: #fff; }
.n-book-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.n-book-name[contenteditable] { outline: none; cursor: text; }
.n-book-del {
  flex: none; display: none; align-items: center; justify-content: center;
  width: 22px; height: 22px; padding: 0; border: none; border-radius: 6px;
  background: transparent; color: inherit; cursor: pointer; opacity: .7;
}
.n-book:hover .n-book-del { display: inline-flex; }
.n-book-del:hover { background: rgba(0,0,0,.12); opacity: 1; }
.n-book.active .n-book-del:hover { background: rgba(255,255,255,.2); }
.n-book-del svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- content ---------- */
.n-content { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 16px 20px 60px; }

.n-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.n-title {
  font-size: 22px; font-weight: 700; margin: 0 8px 0 0;
  padding: 2px 4px; border-radius: 6px; outline: none; cursor: text;
}
.n-title:hover, .n-title:focus { background: var(--surface); }
.n-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--brand-accent); background: transparent; color: var(--brand-accent);
  cursor: pointer; white-space: nowrap;
}
.n-btn:hover { background: var(--brand-accent); color: #fff; }
.n-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.n-btn-primary { background: var(--brand-accent); color: #fff; }
.n-btn-primary:hover { background: var(--brand-accent-hover); }
.n-btn-ghost { border-color: var(--divider); color: var(--text-primary); }
.n-btn-ghost:hover { background: var(--surface); color: var(--text-primary); }
.n-btn-danger { border-color: var(--brand-accent); background: var(--brand-accent); color: #fff; }
.n-btn-danger:hover { background: var(--brand-accent-hover); }
.n-tb-spacer { flex: 1; }

/* ---------- table ---------- */
.n-table-wrap { overflow-x: auto; border: 1px solid var(--divider); border-radius: 12px; background: #fff; }
#n-table { border-collapse: collapse; width: 100%; min-width: 480px; }
#n-table th, #n-table td {
  border: 1px solid var(--divider);
  padding: 0; vertical-align: top;
  position: relative;
}
#n-table thead th {
  background: var(--surface); text-align: left; font-size: 13px; font-weight: 700;
  color: var(--text-primary);
}
.n-th-inner { display: flex; align-items: center; gap: 4px; padding: 9px 10px; }
/* leave room for the resize handle so it never sits under the ⋮ menu */
#n-table thead th:not(.n-th-check):not(.n-th-addcol):not(.n-th-fill):not(.n-th-tools) .n-th-inner { padding-right: 12px; }

/* column resize handle (right edge of a header cell) */
.n-col-resize {
  position: absolute; top: 0; bottom: 0; right: -3px; width: 8px;
  cursor: col-resize; z-index: 3; touch-action: none;
}
.n-col-resize::after {
  content: ''; position: absolute; top: 6px; bottom: 6px; right: 3px; width: 2px;
  border-radius: 2px; background: transparent;
}
.n-col-resize:hover::after { background: var(--brand-accent); }
body.n-resizing { cursor: col-resize; user-select: none; }
body.n-resizing .n-col-resize::after { background: var(--brand-accent); }
.n-th-name { flex: 1; min-width: 0; padding: 1px 2px; border-radius: 4px; outline: none; cursor: text; overflow-wrap: anywhere; }
.n-th-name:hover, .n-th-name:focus { background: #fff; }
.n-col-menu {
  flex: none; width: 20px; height: 20px; padding: 0; border: none; border-radius: 5px;
  background: transparent; color: var(--text-muted); cursor: pointer;
}
.n-col-menu:hover { background: rgba(0,0,0,.08); color: var(--text-primary); }
.n-col-menu svg { width: 15px; height: 15px; fill: currentColor; }
.n-th-check { text-align: center; }
.n-th-check .n-th-inner { justify-content: center; gap: 2px; padding-left: 6px; padding-right: 6px; }
.n-th-checkico { display: inline-flex; color: var(--text-muted); }
.n-th-checkico svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* last column header: the add-column "+" button (row delete lives below it) */
.n-th-tools { text-align: center; vertical-align: middle; }
.n-addcol-btn {
  width: 26px; height: 26px; padding: 0; border: 1px dashed var(--brand-accent); border-radius: 7px;
  background: transparent; color: var(--brand-accent); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.n-addcol-btn:hover { background: var(--brand-accent); color: #fff; border-style: solid; }
.n-addcol-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

/* cells */
.n-cell { padding: 8px 10px; min-height: 40px; }
.n-text {
  min-height: 22px; outline: none; font-size: 14.5px; line-height: 1.45;
  white-space: pre-wrap; word-break: break-word;
}
.n-text:empty::before { content: attr(data-ph); color: var(--text-muted); opacity: .6; }
.n-cell-check { text-align: center; width: 46px; vertical-align: middle; }
.n-check {
  width: 21px; height: 21px; cursor: pointer; accent-color: var(--brand-accent);
}

/* strikethrough for a done row */
#n-table td { position: relative; }
#n-table tr.done td::after {
  content: ''; position: absolute; left: 0; right: 0; top: calc(50% - 1px);
  height: 2px; background: var(--brand-accent); opacity: .75; pointer-events: none;
}
#n-table tr.done td.n-cell-check::after,
#n-table tr.done td.n-row-tools::after { display: none; }
#n-table tr.done .n-text { color: var(--text-muted); }

/* labels */
.n-labels { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.n-label {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px; font-size: 12.5px; font-weight: 600; color: #fff;
  cursor: default;
}
.n-label-x { cursor: pointer; opacity: .8; font-weight: 700; line-height: 1; }
.n-label-x:hover { opacity: 1; }
.n-label-add {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border: 1px dashed var(--divider); border-radius: 50%;
  background: transparent; color: var(--text-muted); cursor: pointer; font-size: 16px; line-height: 1;
}
.n-label-add:hover { border-color: var(--brand-accent); color: var(--brand-accent); }

/* pictures */
.n-imgs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.n-img { position: relative; width: 56px; height: 56px; border-radius: 7px; overflow: hidden; border: 1px solid var(--divider); }
.n-img img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; display: block; }
.n-img-x {
  position: absolute; top: 1px; right: 1px; width: 18px; height: 18px; padding: 0;
  border: none; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff;
  font-size: 12px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.n-img-x:hover { background: var(--brand-accent); }
.n-img-add {
  width: 56px; height: 56px; border: 1px dashed var(--divider); border-radius: 7px;
  background: transparent; color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.n-img-add:hover { border-color: var(--brand-accent); color: var(--brand-accent); }
.n-img-add svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* per-row delete */
.n-row-tools { width: 34px; text-align: center; vertical-align: middle; }
.n-row-del {
  width: 24px; height: 24px; padding: 0; border: none; border-radius: 6px;
  background: transparent; color: var(--text-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.n-row-del:hover { background: rgba(192,70,46,.12); color: var(--brand-accent); }
.n-row-del svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.n-th-tools { width: 34px; }

.n-add-row {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 12px;
  padding: 9px 15px; border: 1px dashed var(--brand-accent); border-radius: 10px;
  background: transparent; color: var(--brand-accent); font-size: 14px; font-weight: 600; cursor: pointer;
}
.n-add-row:hover { background: var(--brand-accent); color: #fff; border-style: solid; }
.n-add-row svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }

.n-empty { padding: 40px 20px; text-align: center; color: var(--text-muted); }

/* ---------- popovers (label picker, column menu) ---------- */
.n-pop {
  position: absolute; z-index: 80; min-width: 190px; max-width: 260px;
  padding: 8px; background: #fff; border: 1px solid var(--divider); border-radius: 11px;
  box-shadow: 0 14px 34px rgba(0,0,0,.2);
}
.n-pop-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); padding: 2px 6px 7px; }
.n-pop-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; }
.n-pop-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 7px;
  cursor: pointer; font-size: 14px; border: none; background: transparent; text-align: left; width: 100%; color: var(--text-primary);
}
.n-pop-item:hover { background: var(--page-bg); }
.n-pop-dot { width: 13px; height: 13px; border-radius: 50%; flex: none; }
.n-pop-item-name { flex: 1; }
.n-pop-item-del { opacity: .5; font-size: 15px; line-height: 1; }
.n-pop-item-del:hover { opacity: 1; color: var(--brand-accent); }
.n-pop-sep { height: 1px; background: var(--divider); margin: 6px 2px; }
.n-pop-new { display: flex; gap: 6px; padding: 2px; }
.n-pop-new input {
  flex: 1; min-width: 0; padding: 7px 9px; border: 1px solid var(--divider); border-radius: 7px;
  font-size: 13.5px; font-family: inherit; outline: none;
}
.n-pop-new input:focus { border-color: var(--brand-accent); }
.n-pop-new button {
  flex: none; padding: 7px 11px; border: none; border-radius: 7px;
  background: var(--brand-accent); color: #fff; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.n-pop-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; }
.n-pop-menu-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 9px; border-radius: 7px;
  cursor: pointer; font-size: 14px; border: none; background: transparent; width: 100%; text-align: left; color: var(--text-primary);
}
.n-pop-menu-item:hover { background: var(--page-bg); }
.n-pop-menu-item.danger { color: var(--brand-accent); }
.n-pop-menu-item svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- confirm modal ---------- */
.n-modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(33,30,28,.5); display: flex; align-items: center; justify-content: center; padding: 20px;
}
.n-modal-backdrop[hidden] { display: none; }
.n-modal {
  background: #fff; border-radius: 16px; padding: 24px 22px 18px; max-width: 380px; width: 100%;
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.n-confirm-msg { margin: 0 0 20px; font-size: 15.5px; line-height: 1.5; }
.n-modal-btns { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- lightbox ---------- */
.n-lightbox {
  position: fixed; inset: 0; z-index: 220; background: rgba(0,0,0,.85);
  display: flex; align-items: center; justify-content: center; padding: 30px;
}
.n-lightbox[hidden] { display: none; }
.n-lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.n-lightbox-close {
  position: absolute; top: 16px; right: 20px; width: 42px; height: 42px;
  border: none; border-radius: 50%; background: rgba(255,255,255,.15); color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer;
}
.n-lightbox-close:hover { background: rgba(255,255,255,.3); }

/* ---------- responsive ---------- */
@media (max-width: 720px) {
  .n-main { flex-direction: column; min-height: 0; }
  .n-sidebar {
    width: 100%; border-right: none; border-bottom: 1px solid var(--divider);
    display: flex; flex-direction: column;
  }
  .n-book-list { flex-direction: row; flex-wrap: wrap; }
  .n-book { flex: none; }
  .n-book-del { display: inline-flex; }
  .n-content { padding: 14px 12px 50px; }
  .n-brand { order: -1; margin-left: 0; }
  .n-header { gap: 10px; }
}
