/* ============================================================
   SỔ SÁCH / ÂM LỊCH — (tách từ style.css, dòng 2056-2242)
   ============================================================ */

  /* ===== Sổ sách — cuốn lịch trang trọng ===== */
  .sosach-layout { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; align-items: start; }
  @container (max-width: 920px) { .sosach-layout { grid-template-columns: 1fr; } }

  .sosach-cal {
    background: var(--bg-card);
    border: 1px solid rgba(158,148,224,.22);
    border-radius: 16px;
    padding: 16px;
    box-shadow: none;
  }
  .sosach-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
  .sosach-nav-btn {
    width: 34px; height: 34px; border-radius: 9px;
    background: rgba(159,146,235,.10); border: 1px solid rgba(169,157,236,.28);
    color: var(--violet); font-size: 20px; line-height: 1; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: all .15s;
  }
  .sosach-nav-btn:hover { background: rgba(161,146,237,.22); border-color: rgba(185,172,255,.5); }
  .sosach-month {
    flex: 1; text-align: center;
    font-family: var(--font-serif); font-size: 19px; font-weight: 700;
    color: #f3efff; letter-spacing: .2px;
  }
  .sosach-today {
    padding: 7px 14px; border-radius: 9px;
    background: rgba(156,146,232,.14); border: 1px solid rgba(174,164,242,.32);
    color: #ddd7ff; font-size: 12px; font-weight: 600; cursor: pointer; transition: all .15s;
  }
  .sosach-today:hover { background: rgba(173,160,241,.26); }

  .sosach-week { display: grid; grid-template-columns: repeat(7, 1fr); margin-bottom: 6px; }
  .sosach-week span {
    text-align: center; font-size: 11px; font-weight: 700; letter-spacing: .08em;
    color: var(--text-faint); text-transform: uppercase; padding: 4px 0;
  }
  .sosach-week span:last-child { color: #c98ea8; }

  .sosach-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
  .sosach-day {
    position: relative; min-height: 66px; border-radius: 10px;
    background: rgba(233,230,255,.035);
    border: 1px solid rgba(171,163,226,.14);
    padding: 5px 6px; cursor: pointer; text-align: left;
    display: flex; flex-direction: column; gap: 3px;
    transition: all .15s;
  }
  .sosach-day:hover { background: rgba(181,169,240,.12); border-color: rgba(198,187,255,.4); }
  .sosach-day.out { opacity: .34; background: rgba(220,218,255,.015); }
  .sosach-day.today { border: 2px solid rgba(253,224,71,.95); background: rgba(251,191,36,0.12); box-shadow: none; }
  .sosach-day.selected {
    background: rgba(167,139,250,0.14);
    border-color: rgba(206,196,255,.65);
    box-shadow: none;
  }
  .sosach-day-num { font-size: 13px; font-weight: 700; color: var(--text-main); line-height: 1; }
  .sosach-day.out .sosach-day-num { color: #9aa0c4; }
  .sosach-day.today .sosach-day-num { color: #fde047; background: rgba(253,224,71,.20); border-radius: 8px; width: fit-content; padding: 1px 6px; }
  .sosach-day-hol { font-size: 9px; line-height: 1.15; color: #fcd34d; font-weight: 600; }
  .sosach-day-lunar { font-size: 10px; color: #9aa0c4; font-weight: 600; line-height: 1; }
  .sosach-day-fast { font-size: 8px; font-weight: 800; letter-spacing: .04em; color: #4ade80; background: rgba(34,197,94,.20); border: 1px solid rgba(74,222,128,.5); border-radius: 4px; padding: 1px 5px; width: fit-content; line-height: 1.3; }
  .sosach-day.fast .sosach-day-num { color: #4ade80; }
  .sosach-day.hol .sosach-day-num { color: #fcd34d; }
  .sosach-day-dots { margin-top: auto; display: flex; gap: 3px; flex-wrap: wrap; min-height: 6px; }
  .ss-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
  .ss-dot-fast { background: #4ade80; box-shadow: none; }
  .ss-dot-holiday { background: #fbbf24; box-shadow: none; }
  .ss-dot-today { background: #fde047; box-shadow: none; }

  .sosach-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(182,174,232,.12); }
  .ss-leg { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: #a7a3c9; font-weight: 600; }

  .sosach-detail {
    background: var(--bg-card);
    border: 1px solid rgba(158,148,224,.22);
    border-radius: 16px; padding: 16px;
    box-shadow: none;
  }
  .sosach-detail-head { margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid rgba(182,174,232,.14); }
  .sosach-detail-date { font-family: var(--font-serif); font-size: 20px; font-weight: 700; color: #f3efff; }
  .sosach-detail-lunar { margin-top: 3px; font-size: 13px; color: #c9c4e8; font-weight: 600; }
  .ss-fast-badge { margin-top: 9px; display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .04em; padding: 3px 11px; border-radius: 6px; }
  .ss-fast-badge.on { background: rgba(251,113,133,.18); color: #fda4af; border: 1px solid rgba(251,113,133,.5); box-shadow: none; }
  .ss-fast-badge:not(.on) { background: rgba(148,163,184,.12); color: #94a3b8; border: 1px solid rgba(148,163,184,.3); }
  .sosach-detail-holiday { margin-top: 8px; font-size: 12px; color: #fcd34d; font-weight: 700; }

  .sosach-form { display: flex; flex-direction: column; gap: 9px; margin-bottom: 16px; }
  .sosach-form-row { display: flex; gap: 9px; }
  .sosach-form select, .sosach-form input, .sosach-form textarea {
    background: rgba(10,12,22,.55); color: var(--text); border: 1px solid rgba(163,155,235,.26);
    border-radius: 9px; padding: 9px 12px; font-size: 13px; font-family: var(--font);
    transition: border-color .15s, box-shadow .15s;
  }
  .sosach-form select { flex: 1; }
  .sosach-form input[type=time] { width: 108px; }
  .sosach-form input, .sosach-form textarea { width: 100%; }
  .sosach-form textarea { resize: vertical; }
  .sosach-form ::placeholder { color: rgba(223,220,255,.3); }
  .sosach-form select:focus, .sosach-form input:focus, .sosach-form textarea:focus {
    outline: none; border-color: #a99bff; box-shadow: none;
  }
  .sosach-form .btn-primary { align-self: flex-end; }

  /* Ô phân loại sự kiện */
  .ss-type-wrap { flex: 1; position: relative; }
  .ss-type-wrap select {
    appearance: none; -webkit-appearance: none; width: 100%;
    background:
      linear-gradient(45deg, transparent 48%, #a99bff 49%, #a99bff 51%, transparent 52%) calc(100% - 18px) 50%/8px 8px no-repeat,
      rgba(33,29,58,.66);
    padding-right: 34px; cursor: pointer; font-weight: 550; letter-spacing: .2px;
  }
  .ss-type-wrap select:hover { border-color: rgba(178,166,255,.5); }

  /* Time picker Sổ sách — dùng 2 dropdown <select> (style ở cuối file) */

  .sosach-list { display: flex; flex-direction: column; gap: 8px; }
  .sosach-empty-list { text-align: center; color: var(--text-faint); font-size: 13px; padding: 18px 0; font-style: italic; }
  /* Form sửa inline trong item Sổ sách */
  .ss-edit-form { display: flex; flex-direction: column; gap: 8px; background: rgba(239,236,255,.05); border: 1px solid rgba(169,157,236,.3); border-radius: 12px; padding: 12px; margin-top: 6px; }
  .ss-edit-form input, .ss-edit-form textarea {
    width: 100%; box-sizing: border-box;
    background: rgba(15,23,42,0.5); color: var(--text-main);
    border: 1px solid rgba(169,157,236,0.28); border-radius: 9px;
    padding: 9px 11px; font-size: 13.5px; font-family: var(--font);
    outline: none; transition: border-color .2s; resize: vertical;
  }
  .ss-edit-form input:focus, .ss-edit-form textarea:focus { border-color: var(--violet); }
  .ss-edit-actions { display: flex; gap: 8px; justify-content: flex-end; }
  .ss-btn-save { background: var(--cyan); color: #fff; border: none; padding: 8px 20px; border-radius: 9px; font-weight: 700; font-size: 12.5px; cursor: pointer; }
  .ss-btn-cancel { background: rgba(71,85,105,0.22); color: var(--text-dim); border: 1px solid rgba(126,166,224,0.22); padding: 8px 16px; border-radius: 9px; font-weight: 600; font-size: 12.5px; cursor: pointer; }
  html[data-theme="light"] .ss-edit-form { background: rgba(250,245,230,0.6); border-color: rgba(181,138,64,0.28); }
  html[data-theme="light"] .ss-edit-form input, html[data-theme="light"] .ss-edit-form textarea { background: rgba(250,245,230,0.9); }
  .sosach-item {
    display: flex; align-items: flex-start; gap: 10px;
    background: rgba(239,236,255,.025); border: 1px solid rgba(176,168,230,.16);
    border-radius: 11px; padding: 10px 12px; transition: all .15s;
  }
  .sosach-item:hover { background: rgba(243,240,255,.05); border-color: rgba(196,188,250,.3); }
  .sosach-item.done { opacity: .55; }
  .sosach-item.done .sosach-item-title { text-decoration: line-through; }
  .sosach-item-check {
    flex: 0 0 auto; width: 20px; height: 20px; margin-top: 1px; border-radius: 6px;
    border: 1.5px solid rgba(207,199,255,.4); background: transparent; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    color: transparent; font-size: 12px; transition: all .15s;
  }
  .sosach-item.done .sosach-item-check { background: #34d399; border-color: #34d399; color: #06231a; }
  .sosach-item-body { flex: 1 1 auto; min-width: 0; }
  .sosach-item-title { font-size: 13px; font-weight: 650; color: #f0ecff; word-break: break-word; }
  .sosach-item-time { font-size: 11px; color: #fbbf24; font-weight: 700; margin-right: 6px; }
  .sosach-item-note { font-size: 12px; color: #a7a3c9; margin-top: 2px; word-break: break-word; white-space: pre-wrap; }
  .sosach-item-tag { display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: .04em; padding: 1px 7px; border-radius: 6px; margin-right: 6px; vertical-align: 1px; }
  .sosach-item-tag.note { background: rgba(125,211,252,.16); color: var(--cyan); border: 1px solid rgba(125,211,252,.3); }
  .sosach-item-tag.event { background: rgba(192,132,252,.16); color: #c084fc; border: 1px solid rgba(192,132,252,.3); }
  .sosach-item-tag.reminder { background: rgba(251,191,36,.16); color: #fbbf24; border: 1px solid rgba(251,191,36,.3); }
  .sosach-item-actions { flex: 0 0 auto; display: flex; gap: 4px; }
  .sosach-item-btn {
    background: transparent; border: none; cursor: pointer; font-size: 13px;
    opacity: .4; padding: 2px 3px; border-radius: 6px; transition: all .15s;
  }
  .sosach-item-btn:hover { opacity: 1; background: rgba(221,214,255,.1); transform: scale(1.12); }

  /* Sổ sách — chống tràn ngang trên mobile (calendar + form thêm ghi chú) */
  @container (max-width: 850px) {
    .sosach-layout, .sosach-cal, .sosach-detail,
    .sosach-grid, .sosach-week, .sosach-form-row,
    .ss-type-wrap, .ss-time-wrap { min-width: 0; }
    .sosach-day { min-width: 0; }
    .sosach-day-hol { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .sosach-form select, .sosach-form input, .sosach-form textarea { min-width: 0; }
    .sosach-cal, .sosach-detail { padding: 12px; }
  }

  .gold-table-wrap { margin-top: 8px; }
  .gold-table-wrap td { padding: 10px 14px; }
  .gold-buy-cell { color: #34d399; font-weight: 600; white-space: nowrap; }
  .gold-own-pl { font-weight: 600; white-space: nowrap; }
  .gold-total-pl { margin-left: 4px; }
  .gold-sell-cell { color: #fb7185; font-weight: 600; white-space: nowrap; }
  .gold-loading, .gold-error { text-align: center; color: var(--text-faint); padding: 24px 0; }
  .gold-error { color: var(--red); }
  .gold-source { margin-top: 10px; font-size: 12px; color: var(--text-faint); }
  .gold-source a { color: var(--accent); }

