/* HANA reference layout — warm paper, quiet typography, and the same visual rhythm
   as the supplied mobile login and dashboard references. */
:root {
  --paper: #f5eee4;
  --paper-deep: #eee3d5;
  --ink: #27211e;
  --muted-ink: #857870;
  --brown: #382d27;
  --line: rgba(91, 70, 56, .13);
  --white-paper: rgba(255, 252, 247, .82);
  --shadow-paper: 0 12px 30px rgba(92, 68, 50, .11);
}

/* ── Login ─────────────────────────────────────────────── */
.reference-login {
  min-height: 100vh;
  background:
    linear-gradient(rgba(63, 47, 38, .32), rgba(63, 47, 38, .32)),
    url('/assets/hana-hero.png') center / cover fixed;
  color: var(--ink);
  overflow-x: hidden;
}

.login-hearts {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
  opacity: .24;
}

.reference-login .login-shell {
  position: relative;
  z-index: 1;
  width: min(100%, 430px);
  min-height: 100vh;
  margin-inline: auto;
  padding: 22px 28px 18px;
  background: rgba(247, 240, 231, .2);
  box-shadow: 0 0 60px rgba(31, 22, 17, .18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.reference-login .login-panel {
  min-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.reference-login .login-brand {
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.reference-login .login-logo {
  width: 174px;
  height: 174px;
  margin: 0 auto 2px;
  border: 0;
  box-shadow: none;
  animation: none;
  overflow: visible;
}

.reference-login .login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.reference-login .brand-ar {
  position: relative;
  margin-top: -7px;
  color: #171310;
  font-family: Georgia, serif;
  font-size: 53px;
  line-height: .9;
  font-weight: 700;
}

.reference-login .brand-ar span {
  position: absolute;
  top: -3px;
  margin-inline-start: 3px;
  color: #7f3027;
  font-family: serif;
  font-size: 20px;
}

.reference-login .brand-latin {
  margin-top: 12px;
  color: #342923;
  font-family: Georgia, serif;
  font-size: 12px;
  letter-spacing: 7px;
}

.reference-login .brand-signature {
  margin-top: 6px;
  color: #4b3930;
  font-family: cursive;
  font-size: 24px;
  font-style: italic;
}

.reference-login .brand-signature b {
  margin-inline: 5px;
  font-family: Georgia, serif;
  font-size: 17px;
}

.reference-login .login-quote {
  margin: 22px 0 17px;
  color: #75665e;
  font-family: Georgia, 'Tajawal', serif;
  font-size: 15px;
  line-height: 1.85;
  text-align: center;
}

.reference-login .day-counter-mini {
  display: none;
}

.reference-login .login-card {
  width: 100%;
  max-width: 315px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.reference-login .reference-input {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 43px;
  padding: 0 12px;
  background: rgba(255, 252, 247, .86);
  border: 1px solid rgba(112, 91, 77, .19);
  border-radius: 8px;
  box-shadow: inset 0 1px 2px rgba(72, 52, 39, .05), 0 3px 12px rgba(92, 68, 50, .06);
}

.reference-login .reference-input:focus-within {
  border-color: rgba(94, 65, 48, .48);
  box-shadow: 0 0 0 3px rgba(119, 86, 64, .09);
}

.reference-login .input-lock {
  position: relative;
  width: 12px;
  height: 10px;
  margin: 0 3px;
  color: #50433b;
  border: 1.4px solid currentColor;
  border-radius: 2px;
}

.reference-login .input-lock::before {
  position: absolute;
  top: -7px;
  left: 1px;
  width: 7px;
  height: 7px;
  border: 1.4px solid currentColor;
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  content: '';
}

.reference-login .reference-input input {
  min-width: 0;
  flex: 1;
  width: auto;
  height: 100%;
  margin: 0;
  padding: 0 10px;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-family: 'Tajawal', sans-serif;
  font-size: 13px;
  text-align: right;
  letter-spacing: 0;
}

.reference-login .reference-input input::placeholder {
  color: #aa9d92;
  font-size: 12px;
}

.reference-login .reference-input button {
  padding: 3px;
  color: #60534b;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 17px;
}

.reference-login .reference-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  height: 43px;
  margin-top: 11px;
  padding: 0 20px;
  color: #f8f0e8;
  background: #2f2926;
  border-radius: 24px;
  box-shadow: 0 6px 15px rgba(42, 31, 25, .16);
  animation: none;
  font-size: 14px;
  letter-spacing: .2px;
}

.reference-login .reference-login-btn span {
  font-size: 22px;
  line-height: 1;
}

.reference-login .reference-login-btn:hover {
  background: #514039;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(42, 31, 25, .2);
}

.reference-login .error-msg {
  min-height: 18px;
  margin-top: 8px;
  color: #9a4238;
  font-size: 12px;
}

.login-player {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: 315px;
  min-height: 58px;
  gap: 8px;
  margin-top: 12px;
  padding: 7px 9px;
  color: #4a3a31;
  background: rgba(255, 252, 247, .65);
  border: 1px solid rgba(115, 90, 72, .13);
  border-radius: 8px;
  box-shadow: var(--shadow-paper);
}

.login-player img {
  width: 41px;
  height: 41px;
  object-fit: cover;
  border-radius: 5px;
}

.player-copy {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  text-align: left;
}

.player-copy strong {
  overflow: hidden;
  color: #3f322b;
  font-family: Georgia, serif;
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-copy span {
  color: #968980;
  font-size: 9px;
}

.login-player button {
  width: 23px;
  height: 23px;
  padding: 0;
  color: #42352e;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 15px;
}

.login-footer {
  margin-top: 10px;
  color: #a09287;
  font-family: Georgia, serif;
  font-size: 9px;
  font-style: italic;
  letter-spacing: .4px;
}

/* ── Dashboard ─────────────────────────────────────────── */
.reference-dashboard {
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  direction: ltr;
}

.reference-dashboard .floating-hearts {
  z-index: 0;
  opacity: .1;
}

.dashboard-app {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  grid-template-columns: 211px minmax(0, 1fr);
  direction: ltr;
}

.dashboard-sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 24px 16px 20px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 252, 247, .92), rgba(244, 233, 220, .86));
  border-right: 1px solid var(--line);
  box-shadow: 8px 0 26px rgba(92, 68, 50, .07);
  backdrop-filter: blur(10px);
  direction: rtl;
}

.sidebar-brand {
  padding: 0 8px 29px;
  text-align: center;
}

.sidebar-brand img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.sidebar-name {
  margin-top: -3px;
  color: #1f1916;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.sidebar-name span {
  color: #8d382e;
  font-size: 11px;
  vertical-align: top;
}

.sidebar-latin {
  margin-top: 7px;
  color: #66584e;
  font-family: Georgia, serif;
  font-size: 9px;
  letter-spacing: 4px;
}

.dashboard-nav {
  display: grid;
  gap: 7px;
}

.dashboard-nav a {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 39px;
  gap: 12px;
  padding: 8px 12px;
  color: #73675f;
  border-radius: 7px;
  font-size: 12px;
  text-decoration: none;
  transition: background .2s ease, color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.dashboard-nav a span {
  width: 21px;
  color: #3b3029;
  font-size: 19px;
  line-height: 1;
  text-align: center;
}

.dashboard-nav a:hover,
.dashboard-nav a.active {
  color: #322821;
  background: linear-gradient(135deg, rgba(235, 220, 204, .9), rgba(221, 202, 183, .7));
  box-shadow: 0 5px 14px rgba(92, 68, 50, .08);
  transform: translateX(-2px);
}

.dashboard-nav a.active {
  font-weight: 700;
}

.dashboard-nav a.active::before {
  position: absolute;
  inset: 8px auto 8px 0;
  width: 3px;
  border-radius: 4px;
  background: #9b4d43;
  content: '';
}

.dashboard-nav a.active span {
  color: #8d382e;
}

.sidebar-note {
  margin-top: auto;
  padding: 22px 8px 18px;
  color: #81746b;
  font-family: Georgia, serif;
  font-size: 12px;
  font-style: italic;
  line-height: 1.8;
  text-align: center;
}

.sidebar-note strong {
  color: #47362e;
  font-size: 18px;
}

.sidebar-logout {
  padding: 8px;
  color: #9a8174;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.dashboard-content {
  min-width: 0;
  direction: rtl;
}

.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  gap: 24px;
  padding: 12px 42px;
  background: rgba(255, 252, 247, .67);
  border-bottom: 1px solid rgba(91, 70, 56, .08);
}

.dashboard-search {
  display: flex;
  align-items: center;
  width: min(340px, 46%);
  height: 34px;
  gap: 8px;
  padding: 0 12px;
  background: rgba(255, 252, 247, .72);
  border: 1px solid rgba(112, 91, 77, .14);
  border-radius: 8px;
  direction: rtl;
}

.dashboard-search span {
  color: #8b7c70;
  font-size: 20px;
  line-height: 1;
}

.dashboard-search input {
  width: 100%;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: 0;
  font-family: 'Tajawal', sans-serif;
  font-size: 11px;
}

.dashboard-search input::placeholder {
  color: #a5988e;
}

.dashboard-user {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #5a4940;
  font-size: 12px;
}

.dashboard-user img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 50%;
}

.topbar-add {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-inline-start: 8px;
  padding: 7px 10px;
  color: #f8eee5;
  background: #302a27;
  border-radius: 16px;
  font-size: 10px;
  text-decoration: none;
  transition: background .2s ease, transform .2s ease;
}

.topbar-add:hover {
  color: #fffaf5;
  background: #57443a;
  transform: translateY(-1px);
}

.topbar-music {
  min-width: 250px;
  flex: 1 1 330px;
  max-width: 370px;
}

.dashboard-topbar .music-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 9px;
  background: rgba(255, 252, 247, .78);
  border: 1px solid rgba(112, 91, 77, .12);
  border-radius: 18px;
  box-shadow: 0 4px 14px rgba(92, 68, 50, .07);
}

.dashboard-topbar .music-icon {
  width: 29px;
  height: 29px;
  flex: 0 0 29px;
  font-size: 18px;
}

.dashboard-topbar .music-info {
  min-width: 0;
}

.dashboard-topbar .music-title,
.dashboard-topbar .music-artist {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dashboard-topbar .music-title {
  color: #5b443a;
  font-size: 11px;
}

.dashboard-topbar .music-artist {
  color: #9a8174;
  font-size: 9px;
}

.dashboard-topbar .music-progress {
  height: 2px;
  margin-top: 4px;
}

.dashboard-topbar .music-controls {
  flex: 0 0 auto;
  gap: 3px;
}

.dashboard-topbar .music-btn {
  width: 25px;
  height: 25px;
  color: #7b382f;
  background: rgba(225, 211, 195, .55);
  font-size: 10px;
}

.dashboard-main {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 15px 32px 38px;
}

.dashboard-hero {
  width: 100%;
  overflow: hidden;
  background: #d9c6b5;
  border-radius: 10px;
  box-shadow: var(--shadow-paper);
}

.dashboard-hero img {
  display: block;
  width: 100%;
  aspect-ratio: 2.868 / 1;
  object-fit: cover;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 9px;
}

.stat-card {
  display: flex;
  min-height: 83px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px;
  color: #6b5b50;
  background: rgba(255, 252, 247, .76);
  border: 1px solid rgba(112, 91, 77, .1);
  border-radius: 8px;
  box-shadow: 0 5px 16px rgba(92, 68, 50, .06);
  text-align: center;
}

.stat-icon {
  color: #7b382f;
  font-family: Georgia, serif;
  font-size: 17px;
  line-height: 1;
}

.stat-card strong {
  margin-top: 3px;
  color: #302722;
  font-family: Georgia, serif;
  font-size: 23px;
  font-weight: 500;
  line-height: 1;
}

.stat-card small {
  margin-top: 5px;
  font-size: 10px;
}

.dashboard-columns {
  display: grid;
  align-items: start;
  grid-template-columns: minmax(0, 1fr) 253px;
  gap: 14px;
  margin-top: 14px;
}

.memories-card,
.message-card {
  position: relative;
  min-width: 0;
  padding: 15px;
  background: rgba(255, 252, 247, .69);
  border: 1px solid rgba(112, 91, 77, .09);
  border-radius: 9px;
  box-shadow: var(--shadow-paper);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  direction: rtl;
}

.section-heading h2,
.message-card h2 {
  color: #302620;
  font-family: Georgia, 'Tajawal', serif;
  font-size: 20px;
  font-weight: 700;
}

.section-heading button {
  color: #8c7a6f;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 10px;
}

.section-heading button span {
  margin-inline-start: 5px;
  font-size: 17px;
}

.dashboard-filters {
  display: flex;
  justify-content: flex-start;
  gap: 6px;
  margin: 10px 0 12px;
  direction: rtl;
}

.dashboard-filters .album-tab {
  padding: 4px 8px;
  color: #85756b;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  font-family: inherit;
  font-size: 10px;
}

.dashboard-filters .album-tab.active,
.dashboard-filters .album-tab:hover {
  color: #4e3c32;
  background: #eadfd3;
  border-color: rgba(112, 91, 77, .12);
}

.album-count {
  color: #9c887b;
  font-size: 9px;
}

.reference-dashboard .gallery-scroll-wrap {
  display: none !important;
}

.reference-dashboard .gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  min-height: 128px;
}

.reference-dashboard .grid-card {
  position: relative;
  min-width: 0;
  height: 128px;
  overflow: hidden;
  background: #ded0c3;
  border: 0;
  border-radius: 6px;
  box-shadow: none;
  cursor: pointer;
}

.reference-dashboard .grid-card > img,
.reference-dashboard .grid-card > video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reference-dashboard .grid-overlay {
  display: flex;
  align-items: end;
  padding: 8px;
  background: linear-gradient(transparent, rgba(32, 24, 19, .7));
}

.reference-dashboard .grid-caption {
  overflow: hidden;
  color: #fffaf4;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-dashboard .grid-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(73, 52, 39, .14);
}

.reference-dashboard .no-photos {
  width: 100%;
  padding: 32px 15px;
  color: #87776d;
  text-align: center;
}

.reference-dashboard .no-photos-icon {
  color: #9b4d43;
  font-family: Georgia, serif;
  font-size: 32px;
}

.reference-dashboard .no-photos h3 {
  margin-top: 6px;
  color: #4b3a31;
  font-family: Georgia, 'Tajawal', serif;
  font-size: 15px;
}

.reference-dashboard .no-photos p {
  margin-top: 4px;
  font-size: 11px;
}

.message-card {
  min-height: 222px;
  padding: 26px 24px 20px;
  background: linear-gradient(145deg, #fff9dc, #f7edc4);
  border: 0;
  border-radius: 3px;
  box-shadow: 3px 8px 18px rgba(92, 68, 50, .13);
  transform: rotate(1.2deg);
  direction: rtl;
}

.message-close,
.message-drawer-toggle,
.message-drawer-backdrop {
  display: none;
}

.message-card::after {
  position: absolute;
  right: 15px;
  bottom: 11px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(141, 61, 52, .18);
  border-radius: 50%;
  color: rgba(141, 61, 52, .45);
  content: '♡';
  font-family: Georgia, serif;
  font-size: 22px;
  line-height: 31px;
  text-align: center;
  transform: rotate(-13deg);
}

.message-card .tape {
  position: absolute;
  top: -8px;
  left: 29px;
  width: 69px;
  height: 26px;
  background: rgba(202, 171, 139, .7);
  transform: rotate(-7deg);
}

.message-card h2 {
  font-size: 19px;
}

.message-card p {
  margin-top: 22px;
  color: #6d5a4d;
  font-family: Georgia, 'Tajawal', serif;
  font-size: 14px;
  line-height: 2;
}

.message-signature {
  margin-top: 13px;
  color: #5b443a;
  font-family: cursive;
  font-size: 25px;
  font-style: italic;
}

.message-signature span {
  color: #8d3d34;
  font-family: Georgia, serif;
}

.message-drawer-list {
  display: none;
}

.drawer-message-item {
  padding: 10px 0;
  border-top: 1px dashed rgba(112, 91, 77, .22);
}

.drawer-message-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.drawer-message-heading strong {
  color: #5e4036;
  font-size: 12px;
}

.drawer-message-heading small {
  color: #9a8174;
  font-size: 9px;
}

.drawer-message-item p {
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.85;
  white-space: pre-wrap;
}

.dashboard-lower {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 100px;
  gap: 30px;
  padding: 18px 10px 0;
  color: #8a7a70;
  font-family: Georgia, 'Tajawal', serif;
  font-size: 12px;
  font-style: italic;
  line-height: 1.7;
}

.dashboard-lower strong {
  color: #58433a;
  font-size: 19px;
}

.dashboard-love {
  color: #736258;
  text-align: right;
}

.written-dashboard-card,
.timeline-dashboard-card,
.reference-composer,
.saved-section {
  position: relative;
  margin-top: 14px;
  padding: 18px;
  color: var(--ink);
  background: rgba(255, 252, 247, .76);
  border: 1px solid rgba(112, 91, 77, .1);
  border-radius: 9px;
  box-shadow: var(--shadow-paper);
  direction: rtl;
}

.written-dashboard-card h2,
.timeline-dashboard-card h2,
.reference-composer h2 {
  color: #302620;
  font-family: Georgia, 'Tajawal', serif;
  font-size: 19px;
}

.section-soft-label,
.composer-kicker {
  color: #9a877a;
  font-size: 10px;
}

.written-memory-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.written-memory {
  display: flex;
  min-height: 112px;
  gap: 8px;
  padding: 12px;
  background: linear-gradient(145deg, #fff9dc, #f7edc4);
  border: 0;
  border-radius: 3px;
  box-shadow: 2px 6px 13px rgba(92, 68, 50, .1);
  transform: rotate(-.7deg);
  transition: transform .2s ease, box-shadow .2s ease;
}

.written-memory.featured {
  background: linear-gradient(145deg, #fff5cf, #f0dfaa);
  transform: rotate(.8deg);
}

.written-memory:nth-child(3n) {
  transform: rotate(1.1deg);
}

.written-memory:hover {
  box-shadow: 3px 10px 18px rgba(92, 68, 50, .15);
  transform: translateY(-3px) rotate(0);
}

.written-heart {
  color: #914238;
  font-family: Georgia, serif;
  font-size: 22px;
}

.written-memory-copy {
  min-width: 0;
}

.written-memory-top {
  display: flex;
  justify-content: space-between;
  gap: 7px;
}

.written-memory-top strong {
  overflow: hidden;
  color: #4a3930;
  font-family: Georgia, 'Tajawal', serif;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.written-memory-top small {
  flex: 0 0 auto;
  color: #9c887b;
  font-size: 9px;
}

.written-memory p {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 8px;
  color: #786960;
  font-family: Georgia, 'Tajawal', serif;
  font-size: 11px;
  line-height: 1.8;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.written-empty {
  padding: 18px;
  color: #9b887c;
  font-size: 12px;
  text-align: center;
}

.timeline-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.timeline-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px;
  background: rgba(245, 238, 228, .6);
  border-right: 3px solid #a4584a;
  border-radius: 6px;
}

.timeline-item time {
  min-width: 100px;
  color: #8f5b50;
  font-family: Georgia, serif;
  font-size: 12px;
}

.timeline-item strong,
.timeline-item span {
  display: block;
}

.timeline-item strong {
  color: #4a3930;
  font-size: 13px;
}

.timeline-item span {
  margin-top: 3px;
  color: #8a7970;
  font-size: 11px;
}

.random-moment-card {
  position: relative;
  margin-top: 14px;
  padding: 18px;
  color: var(--ink);
  background: #eadfd3;
  border: 1px solid rgba(112, 91, 77, .1);
  border-radius: 9px;
  box-shadow: var(--shadow-paper);
  direction: rtl;
}

.random-moment-card .section-heading {
  margin-bottom: 10px;
}

.random-moment-card .section-heading button {
  color: #8f5b50;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.random-moment-card p {
  min-height: 28px;
  color: #6f5d53;
  font-family: Georgia, 'Tajawal', serif;
  font-size: 15px;
  line-height: 1.9;
}

.reference-dashboard #memories,
.reference-dashboard #message,
.reference-dashboard #music,
.reference-dashboard #moments,
.reference-dashboard #timeline {
  scroll-margin-top: 14px;
  scroll-margin-bottom: 96px;
}

.shortcut-target {
  animation: shortcutTargetPulse .85s ease;
}

@keyframes shortcutTargetPulse {
  0% { box-shadow: 0 0 0 0 rgba(164, 88, 74, .34), var(--shadow-paper); }
  100% { box-shadow: 0 0 0 12px rgba(164, 88, 74, 0), var(--shadow-paper); }
}

.stat-card-clickable {
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.stat-card-clickable:hover,
.stat-card-clickable:focus-visible {
  outline: none;
  background: rgba(255, 248, 238, .98);
  box-shadow: 0 8px 20px rgba(92, 68, 50, .14);
  transform: translateY(-2px);
}

.time-modal-card {
  position: relative;
  max-width: 520px;
  padding: 28px 24px 22px;
}

.time-modal-heart {
  color: #9b4d43;
  font-family: Georgia, serif;
  font-size: 30px;
  line-height: 1;
}

.time-modal-card h3 {
  margin: 8px 0 4px;
}

.time-modal-subtitle {
  margin-bottom: 18px;
  color: #9a877a;
  font-size: 12px;
}

.time-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.time-detail {
  padding: 12px 6px 10px;
  background: rgba(245, 238, 228, .7);
  border: 1px solid rgba(112, 91, 77, .1);
  border-radius: 9px;
}

.time-detail strong,
.time-detail span {
  display: block;
}

.time-detail strong {
  color: #6f3932;
  font-family: Georgia, serif;
  font-size: 25px;
  line-height: 1.1;
}

.time-detail span {
  margin-top: 5px;
  color: #8b786c;
  font-size: 11px;
}

.time-total {
  margin-top: 17px;
  color: #5e4036;
  font-family: Georgia, 'Tajawal', serif;
  font-size: 14px;
  font-weight: 700;
}

.time-total-soft {
  margin-top: 6px;
  color: #a08375;
  font-size: 11px;
  font-weight: 400;
}

.time-modal-close {
  position: absolute;
  top: 10px;
  left: 12px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: #7b5d4f;
  background: rgba(225, 211, 195, .5);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font: inherit;
  font-size: 19px;
}

/* ── Reference upload page ───────────────────────────────── */
.reference-upload {
  min-height: 100vh;
  padding: 28px 20px 60px;
  color: var(--ink);
  background: var(--paper);
}

.reference-upload .upload-header {
  align-items: center;
  margin-bottom: 18px;
  padding: 4px 2px 16px;
  border-bottom: 1px solid var(--line);
}

.reference-upload .upload-header img {
  width: 58px;
  height: 58px;
  border: 0;
}

.reference-upload .upload-header h1 {
  color: #302620;
  font-family: Georgia, 'Tajawal', serif;
  font-size: 25px;
}

.upload-subtitle {
  margin-top: 5px;
  color: #96877d;
  font-size: 12px;
}

.reference-upload .upload-card,
.reference-upload .reference-composer {
  max-width: none;
  margin: 0 0 14px;
  padding: 18px;
  background: rgba(255, 252, 247, .76);
  border: 1px solid rgba(112, 91, 77, .1);
  border-radius: 9px;
  box-shadow: var(--shadow-paper);
}

.reference-upload .drop-zone {
  margin: 12px 0;
  padding: 32px 18px;
  background: rgba(245, 238, 228, .55);
  border-color: rgba(112, 91, 77, .25);
}

.reference-upload .drop-zone h3 {
  color: #4b3a31;
  font-family: Georgia, 'Tajawal', serif;
}

.reference-upload .drop-zone p {
  color: #998a80;
}

.upload-section-title {
  margin: 0 0 12px;
  color: #4c3930;
  font-family: Georgia, 'Tajawal', serif;
  font-size: 18px;
}

.upload-fields,
.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.upload-fields {
  margin-bottom: 8px;
}

.reference-upload label {
  display: grid;
  gap: 5px;
  color: #77685f;
  font-size: 11px;
}

.reference-upload input,
.reference-upload textarea,
.reference-upload select {
  width: 100%;
  padding: 9px 10px;
  color: #45362e;
  background: rgba(255, 252, 247, .9);
  border: 1px solid rgba(112, 91, 77, .16);
  border-radius: 6px;
  outline: none;
  font: inherit;
  font-size: 12px;
}

.reference-upload textarea {
  resize: vertical;
}

.reference-upload input:focus,
.reference-upload textarea:focus,
.reference-upload select:focus {
  border-color: rgba(143, 88, 73, .55);
  box-shadow: 0 0 0 3px rgba(143, 88, 73, .08);
}

.composer-heading {
  margin-bottom: 12px;
}

.composer-kicker {
  display: block;
  margin-bottom: 4px;
}

.memory-form {
  display: grid;
  gap: 10px;
}

.form-row-bottom {
  align-items: end;
}

.composer-button {
  min-height: 38px;
  padding: 8px 16px;
  color: #f9f0e8;
  background: #302a27;
  border: 0;
  border-radius: 20px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.composer-button:hover {
  background: #55433a;
}

.composer-message {
  min-height: 18px;
  color: #8f7b70;
  font-size: 11px;
}

.composer-message.ok {
  color: #56745c;
}

.composer-message.error {
  color: #a14e45;
}

.saved-section {
  margin-bottom: 14px;
}

.saved-list {
  display: grid;
  gap: 8px;
}

.saved-note,
.saved-event {
  position: relative;
  padding: 11px 12px;
  background: rgba(245, 238, 228, .65);
  border-right: 3px solid #a4584a;
  border-radius: 6px;
}

.saved-note strong,
.saved-event strong {
  color: #4a3930;
  font-size: 13px;
}

.saved-note small,
.saved-event time {
  margin-inline-start: 8px;
  color: #9a877a;
  font-size: 10px;
}

.saved-note p,
.saved-event span {
  display: block;
  margin-top: 6px;
  color: #776960;
  font-size: 11px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.saved-note button,
.saved-event button {
  position: absolute;
  top: 8px;
  left: 8px;
  color: #9b7067;
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 10px;
}

.lightbox-download {
  position: absolute;
  top: 18px;
  right: 58px;
  z-index: 3;
  padding: 7px 12px;
  color: #f8eee5;
  background: rgba(48, 42, 39, .82);
  border: 1px solid rgba(255, 252, 247, .25);
  border-radius: 16px;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.lightbox-download:hover {
  background: #302a27;
}

.reference-upload .upload-submit {
  color: #f9f0e8;
  background: #302a27;
  box-shadow: 0 6px 15px rgba(42, 31, 25, .16);
  animation: none;
}

.reference-upload .back-link {
  color: #8f776b;
}

.reference-dashboard > #audioPlayer {
  display: none;
}

@media (max-width: 900px) {
  .dashboard-app {
    display: block;
  }

  .dashboard-sidebar {
    position: fixed;
    inset: auto 0 0;
    z-index: 20;
    display: block;
    width: 100%;
    height: auto;
    padding: 7px 8px;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .sidebar-brand,
  .sidebar-note,
  .sidebar-logout {
    display: none;
  }

  .dashboard-nav {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
  }

  .dashboard-nav a {
    min-height: 47px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 4px 2px;
    font-size: 9px;
  }

  .dashboard-nav a span {
    width: auto;
    font-size: 17px;
  }

  .dashboard-topbar {
    padding: 10px 16px;
    flex-wrap: wrap;
  }

  .topbar-music {
    order: 3;
    width: 100%;
    max-width: none;
    flex-basis: 100%;
  }

  .dashboard-main {
    padding: 12px 16px 85px;
  }

  .message-drawer-toggle {
    position: fixed;
    right: 0;
    bottom: 67px;
    z-index: 31;
    display: block;
    padding: 9px 12px 9px 10px;
    color: #f8eee5;
    background: #302a27;
    border: 0;
    border-radius: 16px 0 0 16px;
    box-shadow: 0 5px 16px rgba(42, 31, 25, .2);
    cursor: pointer;
    font: inherit;
    font-size: 11px;
  }

  .message-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 29;
    display: block;
    visibility: hidden;
    background: rgba(39, 29, 23, .28);
    opacity: 0;
    transition: opacity .2s ease, visibility .2s ease;
  }

  .message-drawer-backdrop.is-visible {
    visibility: visible;
    opacity: 1;
  }

  .message-card {
    position: fixed;
    top: 76px;
    right: 0;
    z-index: 30;
    display: block;
    width: min(88vw, 340px);
    max-height: calc(100vh - 160px);
    min-height: 0;
    margin: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    border-radius: 4px 0 0 4px;
    box-shadow: -8px 12px 25px rgba(92, 68, 50, .2);
    transform: translateX(110%);
    transition: transform .25s ease;
  }

  .message-card.is-open {
    transform: translateX(0);
  }

  .message-drawer-list {
    display: block;
    margin-top: 17px;
    padding-top: 3px;
  }

  .message-close {
    position: absolute;
    top: 8px;
    left: 10px;
    z-index: 1;
    display: grid;
    width: 28px;
    height: 28px;
    place-items: center;
    color: #6d5144;
    background: rgba(255, 252, 247, .6);
    border: 1px solid rgba(112, 91, 77, .14);
    border-radius: 50%;
    cursor: pointer;
    font: inherit;
    font-size: 20px;
    line-height: 1;
  }

  body.message-drawer-open {
    overflow: hidden;
  }
}

@media (max-width: 620px) {
  .reference-login {
    background-position: center;
  }

  .reference-login .login-shell {
    width: min(100%, 398px);
    padding: 17px 28px 16px;
  }

  .reference-login .login-panel {
    min-height: calc(100vh - 33px);
  }

  .reference-login .login-logo {
    width: 162px;
    height: 162px;
  }

  .reference-login .brand-ar {
    font-size: 49px;
  }

  .reference-login .login-quote {
    margin-top: 18px;
    font-size: 14px;
  }

  .dashboard-topbar {
    min-height: 62px;
  }

  .dashboard-user {
    gap: 7px;
    font-size: 10px;
  }

  .dashboard-user img {
    width: 33px;
    height: 33px;
  }

  .dashboard-search {
    width: 55%;
  }

  .topbar-music {
    min-width: 0;
  }

  .dashboard-main {
    padding-inline: 10px;
  }

  .time-modal-card {
    padding: 25px 14px 18px;
  }

  .time-detail-grid {
    gap: 6px;
  }

  .time-detail {
    padding-inline: 3px;
  }

  .time-detail strong {
    font-size: 20px;
  }

  .dashboard-hero img {
    min-height: 145px;
    aspect-ratio: 1.75 / 1;
    object-position: center;
  }

  .dashboard-stats {
    gap: 5px;
  }

  .stat-card {
    min-height: 69px;
    padding: 5px 2px;
  }

  .stat-icon {
    font-size: 13px;
  }

  .stat-card strong {
    font-size: 18px;
  }

  .stat-card small {
    font-size: 8px;
  }

  .dashboard-columns {
    grid-template-columns: 1fr;
  }

  .message-card {
    min-height: 185px;
  }

  .reference-dashboard .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .reference-dashboard .grid-card {
    height: 138px;
  }

  .dashboard-lower {
    padding-bottom: 3px;
  }

  .written-memory-list {
    grid-template-columns: 1fr;
  }

  .upload-fields,
  .reference-upload .form-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-nav a,
  .reference-login .reference-login-btn,
  .reference-dashboard .grid-card {
    transition: none;
  }
}