/* =========================================================
   Sakura Beaded Bags - shared styles (all pages use this)
   Colours/fonts are taken from the Figma prototype.
   ========================================================= */
:root {
  --pink-600: #c4557a;
  --pink-500: #d9668b;      /* main buttons, active menu */
  --pink-400: #e585a4;
  --pink-200: #f5dce0;      /* sidebar, soft fills */
  --pink-100: #fbe9ed;
  --pink-50:  #fdf0f3;      /* table headers, summary boxes */
  --cream:    #fdf5ef;      /* page background */
  --ink:      #4a2c35;      /* main text */
  --muted:    #8a7479;
  --line:     #f0e4e4;
  --white:    #ffffff;
  --green-bg: #ddf0e3;  --green: #3f7a55;
  --amber-bg: #fdebc8;  --amber: #8a6320;
  --blue-bg:  #dcebfb;  --blue:  #3d6fa5;
  --danger:   #c0392b;
  --radius:   16px;
  --radius-sm: 10px;
  --shadow:   0 2px 10px rgba(122, 64, 82, .07);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body { font-family: 'Poppins', sans-serif; font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--cream); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--pink-500); outline-offset: 2px; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- App layout ---------- */
.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; }
.content { width: 100%; max-width: 1680px; margin: 0 auto; padding: 24px 28px 40px; flex: 1; }

/* ---------- Sidebar ---------- */
.sidebar { background: var(--pink-200); padding: 28px 16px 20px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40; }
.brand { display: flex; justify-content: center; margin-bottom: 32px; }
.brand img { width: 120px; }
.brand-fallback { font-weight: 700; font-size: 24px; letter-spacing: 3px; color: #3a1f27; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; font-weight: 500; transition: background .15s; }
.nav a:hover { background: rgba(217, 102, 139, .14); }
.nav a.active { background: var(--pink-500); color: var(--white); }
.sidebar-foot { margin-top: auto; padding: 0 8px; font-size: 11.5px; color: var(--muted); }
.sidebar-foot strong { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.sidebar-backdrop { display: none; }

/* ---------- Top bar ---------- */
.topbar { background: var(--white); padding: 18px 28px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 30; }
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 24px; font-weight: 600; line-height: 1.2; }
.topbar-title p { color: var(--muted); font-size: 13px; }
.menu-btn { display: none; padding: 8px; border-radius: 10px; }
.profile { position: relative; }
.profile-btn { display: flex; align-items: center; gap: 10px; padding: 4px 6px; border-radius: 12px; }
.profile-btn:hover { background: var(--pink-50); }
.avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--pink-200); color: var(--pink-600); display: grid; place-items: center; font-weight: 600; font-size: 13px; }
.profile-text { display: flex; flex-direction: column; text-align: left; line-height: 1.25; }
.profile-text strong { font-size: 13px; font-weight: 600; }
.profile-text small { color: var(--muted); font-size: 11.5px; }
.profile-btn .icon { width: 14px; height: 14px; transition: transform .15s; }
.profile-btn[aria-expanded="true"] .icon { transform: rotate(180deg); }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; background: var(--white); border-radius: 12px; box-shadow: 0 8px 24px rgba(74, 44, 53, .16); padding: 6px; display: none; }
.dropdown.is-open { display: block; }
.dropdown a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.dropdown a:hover { background: var(--pink-50); }

/* ---------- Cards ---------- */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 17px; font-weight: 600; }
.card-sub { color: var(--muted); font-size: 12.5px; }
.section-title { font-size: 14px; font-weight: 600; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 10px; font-weight: 500; font-size: 13.5px; border: 1px solid transparent; transition: background .15s, box-shadow .15s; }
.btn-primary { background: var(--pink-500); color: var(--white); }
.btn-primary:hover { background: var(--pink-600); }
.btn-outline { background: var(--white); border-color: var(--line); }
.btn-outline:hover { background: var(--pink-50); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }
.btn-ghost-danger { color: var(--danger); }
.icon-btn { padding: 6px; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--pink-50); color: var(--pink-600); }

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.badge-amber { background: var(--amber-bg); color: var(--amber); }
.badge-blue  { background: var(--blue-bg);  color: var(--blue); }
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-pink  { background: var(--pink-100); color: var(--pink-600); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 400; color: var(--muted); background: var(--pink-50); padding: 10px 14px; white-space: nowrap; }
.table th:first-child { border-radius: 10px 0 0 10px; }
.table th:last-child  { border-radius: 0 10px 10px 0; }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table .strong { font-weight: 600; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field label { font-size: 13px; font-weight: 500; }
.field .req { color: var(--pink-500); }
.input, .select, .textarea { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); font-size: 13.5px; transition: border-color .15s, box-shadow .15s; }
.input::placeholder { color: #b6a5a9; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--pink-400); box-shadow: 0 0 0 3px rgba(217, 102, 139, .15); }
.input[readonly] { background: var(--pink-50); color: var(--muted); }
.input.is-error { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(192, 57, 43, .12); }
.field-error { color: var(--danger); font-size: 12px; min-height: 0; }
.form-alert { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c0; padding: 10px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.input-affix { position: relative; }
.input-affix .input { padding-right: 44px; }
.input-affix .affix-btn { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); padding: 6px; color: var(--muted); border-radius: 8px; }
.input-affix .affix-btn:hover { color: var(--pink-600); }
.hint { color: var(--muted); font-size: 12px; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(60, 30, 40, .5); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 100; }
.modal-overlay.is-open { display: flex; }
.modal-overlay.is-top { z-index: 110; }
.modal { background: var(--white); border-radius: 20px; width: 100%; max-width: 560px; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(60, 30, 40, .3); animation: modal-in .18s ease-out; }
.modal-lg { max-width: 760px; }
.modal-head { padding: 22px 26px 6px; display: flex; justify-content: space-between; gap: 12px; }
.modal-head h2 { font-size: 20px; font-weight: 600; }
.modal-head p { color: var(--muted); font-size: 13px; }
.modal-body { padding: 14px 26px; overflow-y: auto; }
.modal-foot { padding: 14px 26px 22px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line); }
.modal-foot .actions { display: flex; gap: 10px; margin-left: auto; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Summary box (pink) ---------- */
.summary { background: var(--pink-50); border-radius: 14px; padding: 16px 18px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.summary small { display: block; color: var(--muted); font-size: 12px; }
.summary strong { font-size: 26px; font-weight: 600; color: var(--pink-500); line-height: 1.2; }
.note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 12px; margin-top: 10px; }
.note .icon { width: 14px; height: 14px; margin-top: 3px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { background: var(--ink); color: var(--white); padding: 12px 18px; border-radius: 12px; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); display: flex; align-items: center; gap: 10px; animation: modal-in .2s ease-out; }
.toast .icon { color: #9be3b4; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.is-open { transform: none; }
  .sidebar-backdrop.is-open { display: block; position: fixed; inset: 0; background: rgba(60, 30, 40, .4); z-index: 35; }
  .menu-btn { display: inline-flex; }
  .content { padding: 18px 16px 32px; }
  .topbar { padding: 14px 16px; }
  .profile-text { display: none; }
}
@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
  .summary { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }