/* Linked last, after app.css and screens.css: what stands here is meant to win. */
/* --- Softness: rounder shapes, motion as feedback, and a few expressive moments.
   Work surfaces (tables, forms) stay still; only feedback and empty moments move. --- */

/* Shape */
.btn, .btn-sm { --bs-btn-border-radius: var(--dm-radius-pill); }
.btn-icon { border-radius: 50%; }
.form-control, .form-select { border-radius: var(--dm-radius-field); }
.sidebar-wrapper .nav-link { border-radius: var(--dm-radius-pill); padding-left: var(--dm-3); padding-right: var(--dm-3); }
.segmented { border-radius: var(--dm-radius-pill); }
.segmented > button, .segmented > label { border-radius: var(--dm-radius-pill); }
.dropdown-menu { border-radius: var(--dm-radius-lg); padding: var(--dm-1); }
.dropdown-item { border-radius: var(--dm-radius-md); }
.modal-content { border-radius: var(--dm-radius-xl); }
.toast { border-radius: var(--dm-radius-pill); padding-left: var(--dm-4); padding-right: 1.25rem; }
.drawer { border-left: 0; border-radius: var(--dm-radius-xl) 0 0 var(--dm-radius-xl); box-shadow: var(--dm-shadow-panel); }
@media (max-width: 575.98px) { .drawer { border-radius: 0; } }

/* Feedback */
.btn { transition: background-color var(--dm-fast) var(--dm-ease), border-color var(--dm-fast) var(--dm-ease), color var(--dm-fast) var(--dm-ease), transform var(--dm-fast) var(--dm-ease); }
.btn:active:not(:disabled) { transform: scale(.96); }
.sidebar-wrapper .nav-link, .segmented > button, .segmented > label, .tabs button, .link-row, .dropdown-item { transition: background-color var(--dm-fast) var(--dm-ease), color var(--dm-fast) var(--dm-ease); }
.table-hover > tbody > tr > * { transition: background-color var(--dm-fast) var(--dm-ease); }
.offcanvas, .offcanvas-md { transition: transform var(--dm-slow) var(--dm-ease); }
.modal.fade .modal-dialog { transform: scale(.94); transition: transform var(--dm-slow) var(--dm-spring); }
.modal.show .modal-dialog { transform: none; }
.view-section { animation: dm-fade var(--dm-fast) var(--dm-ease); }
.drawer-body > * { animation: dm-rise var(--dm-slow) var(--dm-ease) both; }
.drawer-body > :nth-child(2) { animation-delay: 30ms; }
.drawer-body > :nth-child(3) { animation-delay: 60ms; }
.drawer-body > :nth-child(n+4) { animation-delay: 90ms; }
.drawer-header .pill { animation: dm-pop var(--dm-slow) var(--dm-spring); }
.toast { animation: dm-rise var(--dm-slow) var(--dm-spring); }
.changed-mark { color: var(--dm-warning-fg); }
.changed-notice > :first-child { flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere; }
.changed-lines { margin: var(--dm-1) 0 0; padding-left: var(--dm-5); }
.changed-notice { margin-top: var(--dm-4); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--dm-2) var(--dm-3); }
.btn-tool.active { background: var(--dm-accent-soft); }
.nav-count.bump { animation: dm-pop 420ms var(--dm-spring); }
@keyframes dm-fade { from { opacity: 0; } }
@keyframes dm-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes dm-pop { from { transform: scale(.6); } }

/* The step a purchase order is on is a moving wave; finished steps are straight lines. */
.stepper li.current:not(:last-child) {
    border-top-color: transparent;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='6' viewBox='0 0 16 6'%3E%3Cpath d='M0 3c2-3.200 6-3.200 8 0s6 3.200 8 0' fill='none' stroke='%2317181c' stroke-width='2.400'/%3E%3C/svg%3E") repeat-x 0 0 / 16px 6px border-box;
    animation: dm-wave 900ms linear infinite;
}
@keyframes dm-wave { to { background-position-x: 16px; } }

/* Loader: a shape that morphs instead of a spinner. */
.loader { width: 1.75rem; height: 1.75rem; margin: 0 auto; background: var(--dm-text); animation: dm-morph 1.6s var(--dm-ease) infinite; }
@keyframes dm-morph {
    0%, 100% { border-radius: 50%; transform: rotate(0); }
    33% { border-radius: 28%; transform: rotate(120deg); }
    66% { border-radius: 50% 50% 50% 12%; transform: rotate(240deg); }
}

/* Soft eight-point shape, used for empty states and the "sent" moment. */
.soft-shape { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 3.25rem; height: 3.25rem; }
.soft-shape::before, .soft-shape::after { content: ""; position: absolute; inset: 8%; border-radius: 30%; background: var(--dm-accent-soft); }
.soft-shape::after { transform: rotate(45deg); }
.soft-shape > i { position: relative; z-index: var(--dm-z-raised); font-size: 1.25rem; }
.empty-state .soft-shape { margin-bottom: var(--dm-3); animation: dm-pop var(--dm-slow) var(--dm-spring); }
.burst { position: fixed; left: 50%; top: 42%; z-index: var(--dm-z-top); width: 7rem; height: 7rem; margin: -3.5rem 0 0 -3.5rem; pointer-events: none; animation: dm-burst 1100ms var(--dm-ease) forwards; }
.burst::before, .burst::after { background: var(--dm-spot); }
.burst > i { font-size: 3rem; color: var(--dm-spot-fg); }
@keyframes dm-burst {
    0% { opacity: 0; transform: scale(.3) rotate(-40deg); }
    25% { opacity: 1; transform: scale(1.12) rotate(6deg); }
    40%, 75% { opacity: 1; transform: scale(1) rotate(0); }
    100% { opacity: 0; transform: scale(1.15) rotate(10deg); }
}

/* Login: two large slow shapes behind the form. */
.auth-page { position: relative; overflow: hidden; }
.auth-card { position: relative; z-index: var(--dm-z-raised); }
/* Fixed, so the shapes never widen the page. */
.auth-page::before, .auth-page::after { content: ""; position: fixed; z-index: 0; animation: dm-drift 18s ease-in-out infinite alternate; }
.auth-page::before { width: 44rem; height: 44rem; top: -20rem; right: -14rem; background: var(--dm-spot); border-radius: 42% 58% 63% 37% / 45% 40% 60% 55%; }
.auth-page::after { width: 34rem; height: 34rem; bottom: -18rem; left: -12rem; background: var(--dm-neutral-bg); border-radius: 60% 40% 35% 65% / 50% 62% 38% 50%; animation-duration: 24s; animation-direction: alternate-reverse; }
@keyframes dm-drift {
    to { border-radius: 58% 42% 38% 62% / 55% 60% 40% 45%; transform: rotate(24deg) scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
