:root {
--mg-primary: #5b21b6;
--mg-primary-2: #0ea5e9;
--mg-primary-dark: #312e81;
--mg-accent: #14b8a6;
--mg-danger: #e11d48;
--mg-text: #172033;
--mg-muted: #64748b;
--mg-bg: #f7f8ff;
--mg-surface: #eef4ff;
--mg-surface-2: #ffffff;
--mg-border: #dbe4f3;
--mg-focus: #2563eb;
--mg-gradient: linear-gradient(135deg, #6d28d9 0%, #2563eb 52%, #06b6d4 100%);
--mg-gradient2: linear-gradient(135deg, #2563eb 0%, #25b3eb 52%, #06b6d4 100%);
--mg-soft-gradient: linear-gradient(135deg, rgba(109,40,217,.13) 0%, rgba(37,99,235,.10) 50%, rgba(6,182,212,.12) 100%);
--mg-strong-gradient: linear-gradient(135deg, rgba(37, 179, 235, .4) 25%, rgba(37, 99, 235, .4) 100%);

--mg-radius: 3px;
--mg-shadow: 0 10px 30px rgba(43, 52, 91, .08), 0 1px 2px rgba(43, 52, 91, .08);
--md-shadow: 0 18px 45px rgba(43, 52, 91, .12), 0 2px 8px rgba(43, 52, 91, .08);
--mg-header-height: 48px;
--mg-footer-height: 58px;
--mg-mobile-header-height: 48px;
--mg-mobile-footer-height: 58px;


/* Override Bootstrap radii (per coerenza globale) */
--bs-border-radius: 3px;
--bs-border-radius-sm: 2px;
--bs-border-radius-lg: 4px;
--bs-border-radius-xl: 5px;
--bs-border-radius-xxl: 6px;
--bs-btn-border-radius: 3px;
}
html, body { height:100%; background: radial-gradient(circle at 8% -10%, rgba(109,40,217,.12), transparent 26%), radial-gradient(circle at 100% 0%, rgba(14,165,233,.12), transparent 24%), var(--mg-bg); color: var(--mg-text);}
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; position: relative; }
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: url("../assets/memoget_logo_color.svg") center center / min(54vw, 420px) auto no-repeat;
  opacity: .035;
}
#app {
  position: relative;
  isolation: isolate;
}
#app::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("../assets/memoget_logo_color.svg") center center / min(54vw, 420px) auto no-repeat;
  opacity: .045;
}
#app.bg-white {
  background:
    linear-gradient(135deg, rgba(109,40,217,.045) 0%, rgba(37,99,235,.035) 52%, rgba(6,182,212,.045) 100%),
    rgba(255,255,255,.86) !important;
}
a { color: inherit; }
a:hover { opacity: .9; }
header { background: rgba(255,255,255,.88); border-bottom: 1px solid rgba(219,228,243,.85); backdrop-filter: blur(16px); }
label { font-weight: 500; }
.card { border: 1px solid var(--mg-border); border-radius: var(--mg-radius); box-shadow: var(--mg-shadow); }
.alert, .badge, .toast, .list-group-item { border-radius: var(--mg-radius); }
.fs-03{ font-size: .3rem; }
.fs-04{ font-size: .4rem; }
.fs-05{ font-size: .5rem; }
.fs-06{ font-size: .6rem; }
.fs-07{ font-size: .7rem; }
.fs-08{ font-size: .8rem; }
.fs-09{ font-size: .9rem; }
.fs-1{ font-size: 1rem; }
.mg-color-badge {
  --tag-color: #111827;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 22px;
  padding: .05rem .4rem;
  border: 1px solid var(--tag-color);
  background: var(--tag-color);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.text-mg-primary { color: var(--mg-primary); }
.text-mg-primary-2 { color: var(--mg-primary-2); }
.text-mg-primary-dark { color: var(--mg-primary-dark); }
.text-mg-accent { color: var(--mg-accent); }
.text-mg-danger { color: var(--mg-danger); }

/* GENERAL */
#dynamicPages li a {font-size:.95rem;color: #111827; font-weight: 500;}
#dynamicPages li a:hover{color:var(--mg-primary-dark);; font-weight: 500;}
#logoutHeaderBtn {line-height: 1;font-weight: 600;text-transform: lowercase;border-width: 2px;}
.auth-only {display: none;}
.auth-only.visible {display: block;}
.mmodal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 1050;}

.app-container { display:flex; flex-direction:column; min-height:100vh; padding-top: var(--mg-header-height); position: relative; z-index: 1; }
.app-container:has(.memoget-footer) { padding-bottom: var(--mg-footer-height); }
@supports not selector(:has(*)) {
  .app-container { padding-bottom: var(--mg-footer-height); }
}
.app-container > header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  min-height: var(--mg-header-height);
  z-index: 1030;
}
/* Forms */
.form-control, .form-select, .input-group-text, .form-check-input {border-radius: var(--mg-radius) !important;border: 1px solid var(--mg-border);background-color: rgba(255,255,255,.96);}
.form-control:focus, .form-select:focus {border-color: var(--mg-focus);box-shadow: 0 0 0 .2rem rgba(37,99,235,.12);outline: 0;}
.form-control-xm {
  font-size: .8125rem;        /* ~13px */
  line-height: 1.2;
  padding: .20rem .50rem;     /* compatti */
  border-radius: 0 !important;/* squadrati */
  min-height: 28px;           /* opz.: target compatto, regola se vuoi */
}
textarea.form-control-xm {
  padding: .30rem .50rem;     /* un filo più comodo per multilinea */
}

/* Select */
.form-select-xm {font-size: .8125rem;line-height: 1.2;padding: .20rem 1.75rem .20rem .50rem; /* spazio per caret a destra */
    border-radius: 0 !important;min-height: 28px;background-position: right .5rem center;}
.select{padding-top:-1;height:28px;font-size:12px;padding-top:5px;}
/* Input group “xs” */
.input-group-xm > .form-control,
.input-group-xm > .form-select,
.input-group-xm > .input-group-text,
.input-group-xm > .btn {font-size: .8125rem;padding: .20rem .50rem;border-radius: 0 !important;}
.input-group > .form-select {flex: 0 0 170px; /* larghezza prefisso */}
.no-border{border:0 !important;font-weight: 800;color: var(--mg-primary-2);font-size:.9rem !important;}
/* Checkbox / radio compatti */
.form-check-input-xm { width: .9rem; height: .9rem; margin-top: .35rem; }
.form-check-label-xm { font-size: .8125rem; }
/* Bottoni compatti */
.btn-xm {font-size: .8125rem;padding: .25rem .55rem;border-radius: 0px;}/*border-radius: 0px !important;*/

/* Buttons */
.btn-dark { background: var(--mg-gradient2); border-color: var(--mg-primary-2); box-shadow: 0 8px 18px rgba(91,33,182,.18); }
.btn-dark:hover { filter: saturate(1.08) brightness(1.02);border-color: #b8c5dc;  }/*transform: translateY(-1px);*/
.btn-outline-dark { color: var(--mg-primary-dark); border-color: #7f8794; background: rgba(255,255,255,.78); }
.btn-outline-dark:hover { color: #fff; border-color: transparent; background: var(--mg-primary-dark); }
.btn-outline-primary { color: #2563eb; border-color: #bfdbfe; background: rgba(239,246,255,.85); }
.btn-outline-primary:hover { color: #fff; border-color: #2563eb; background: #2563eb; }
.btn-outline-danger { color: var(--mg-danger); border-color: #fecdd3; background: #fff1f2; }
.btn-outline-danger:hover { color: #fff; border-color: var(--mg-danger); background: var(--mg-danger); }
.btn-outline-danger { border-width: 1px; }
#logoutBtn{width: 25px;height: 25px;}

/* Offcanvas / modals / dropdowns */
.offcanvas, .modal-content, .dropdown-menu { border-radius: 4px; border: 1px solid rgba(219,228,243,.95); box-shadow: var(--md-shadow); }

footer { background:rgba(255,255,255,.9); }
.footer-icons i { font-size:1.35rem; }
.memoget-footer { background: rgba(255,255,255,.9); border-top: 1px solid rgba(219,228,243,.9); position: fixed; left: 0; right: 0; bottom: 0; width: 100%; min-height: var(--mg-footer-height); z-index: 1030; box-shadow: 0 -10px 28px rgba(43,52,91,.08); backdrop-filter: blur(16px); }
.memoget-footer nav { min-height: var(--mg-footer-height); }
.memoget-footer nav a { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .25rem; min-width: 42px; padding: .38rem .58rem .58rem; border-radius: 3px; color: #566179; transition: background .18s ease, color .18s ease, transform .18s ease; }
.memoget-footer nav a:hover { background: var(--mg-soft-gradient); color: var(--mg-primary); opacity: 1; transform: translateY(-4px);cursor:pointer; }
.memoget-footer nav a.is-active { color: var(--mg-primary-2); opacity: 1; }
.memoget-footer nav a.is-active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: .22rem;
  width: 24px;
  height: 3px;
  border-radius: 999px;
  background: var(--mg-gradient2);
  transform: translateX(-50%);
}
.memoget-footer i { font-size: 1.2rem; }

.offcanvas-start { transition: transform .4s ease; }
main { flex:1; }
.mg-menu-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}
.brand { display:flex; align-items:center; gap:.6rem;text-decoration: none;font-weight: 800;font-size: 24px; color: var(--mg-primary-dark); }
.brand img { height:28px; }
.brand strong {background: var(--mg-gradient);-webkit-background-clip: text;background-clip: text;color: transparent;}
.brand strong:hover { background: var(--mg-gradient2);  -webkit-background-clip: text; background-clip: text;color: transparent; }

.container-slim { max-width: 480px; }
.bg-red{ background: rgba(255, 0, 0, .05) !important; border-color: rgba(255, 0, 0, .15) !important; }
.bg-green{ background: rgba(46, 154, 204, 0.15) !important; border-color: rgba(46, 120, 204, 0.15) !important; }

.mg-storage-status {
  --mg-storage-color: #16a34a;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: var(--mg-storage-color) !important;
  line-height: 1;
}
.mg-storage-status i {
  font-size: 1.1rem;
  color: var(--mg-storage-color) !important;
}
.mg-storage-status-green { --mg-storage-color: #16a34a; }
.mg-storage-status-blue { --mg-storage-color: #2563eb; }
.mg-storage-status-orange { --mg-storage-color: #f97316; }
.mg-storage-status-red { --mg-storage-color: #dc2626; }
.mg-storage-status:hover,
.mg-storage-status:focus-visible {
  opacity: .82;
}
.mg-access-logs-status {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: #374151 !important;
  line-height: 1;
}
.mg-access-logs-status i {
  font-size: 1.1rem;
  color: #374151 !important;
}
.mg-access-logs-status:hover,
.mg-access-logs-status:focus-visible {
  opacity: .82;
}
.mg-notifications-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: #374151 !important;
  line-height: 1;
  position: relative;
}
.mg-notifications-btn i {
  font-size: 1.1rem;
  color: inherit !important;
}
.mg-notifications-pulse {
  color: #6531EC !important;
}
.mg-notifications-pulse::after {
  content: "";
  position: absolute;
  inset: 2px;
  border: 1px solid currentColor;
  border-radius: 50%;
  animation: mg-notification-pulse 1.35s ease-out infinite;
}
.mg-notifications-menu {
  display: none;
  min-width: 260px;
  max-width: min(360px, calc(100vw - 1rem));
  max-height: min(420px, calc(100vh - 5rem));
  overflow-y: auto;
  padding: .25rem;
  z-index: 2000;
  background: rgba(255,255,255,.98);
}
#notificationsWrap {
  position: relative;
}
#notificationsMenu.show {
  display: block;
  position: fixed;
  left: auto;
  margin: 0;
  transform: none !important;
}
.mg-notification-item {
  display: grid;
  gap: .12rem;
  white-space: normal;
  line-height: 1.2;
  padding: .45rem .6rem;
}
.mg-notification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: stretch;
  gap: .1rem;
}
.mg-notification-row + .mg-notification-row {
  border-top: 1px solid var(--mg-border);
}
.mg-notification-row .mg-notification-item {
  min-width: 0;
}
.mg-notification-read .mg-notification-item,
.mg-notification-read .mg-notification-title,
.mg-notification-read .mg-notification-date {
  color: var(--mg-muted) !important;
  font-weight: 400 !important;
}
.mg-notification-hide {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  min-height: 100%;
  padding: 0;
  color: var(--mg-muted);
  text-decoration: none;
}
.mg-notification-hide:hover,
.mg-notification-hide:focus-visible {
  color: var(--mg-danger);
  background: #fff1f2;
}
.mg-notification-title {
  font-size: .78rem;
  font-weight: 600;
}
.mg-notification-pinned {
  color: var(--mg-primary-2);
  margin-right: .25rem;
}
.mg-notification-title,
.mg-notification-date {
  min-width: 0;
  overflow-wrap: anywhere;
}
.mg-notification-date {
  color: var(--mg-muted);
  font-size: .72rem;
  font-weight: 400;
}
.mg-notification-image {
  display: block;
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  background: var(--mg-bg);
  border: 1px solid var(--mg-border);
}
.mg-notification-body {
  min-width: 0;
  overflow-wrap: anywhere;
}
@keyframes mg-notification-pulse {
  0% {
    transform: scale(.82);
    opacity: .65;
  }
  100% {
    transform: scale(1.55);
    opacity: 0;
  }
}

/* Toolbar globale sotto header */
.mg-app-toolbar {
  background: rgba(255,255,255,.82);
  position: sticky;
  top: var(--mg-header-height);
  z-index: 1020;
  border-bottom: 1px solid rgba(219,228,243,.72);
  backdrop-filter: blur(14px);
}
.mg-floating-search-btn {
    position: fixed;
    top: var(--mg-search-launcher-top, calc(var(--mg-header-height) + 52px));
    right: clamp(.75rem, 2vw, 1.5rem);
    z-index: 1021;
    font-weight: 700;
    width: 110px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 42px;
    padding-inline: 1rem;
    border-radius: 0% !important;
    box-shadow: 0 5px 16px rgba(17, 24, 39, .52);
}
.mg-floating-search-btn i {
  font-size: 1.1rem;
}
.mg-toolbar-inner {
  display: grid;
  gap: .45rem;
  padding-top: .5rem;
  padding-bottom: .5rem;
}
.mg-toolbar-row,
.mg-pin-form,
.mg-pin-actions,
.mg-search-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}
.mg-pin-form {
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
.mg-pin-form .input-group {
  width: min(100%, 460px);
  margin-inline: auto;
}
.mg-pin-actions {
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
.mg-pin-countdown {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 30px;
}
.mg-pin-pie {
  --pin-used: 0deg;
  --pin-color: #16a34a;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border: 1px solid rgba(219,228,243,.9);
  border-radius: 50%;
  background:
    conic-gradient(var(--pin-color) 0deg calc(360deg - var(--pin-used)), #e5e7eb calc(360deg - var(--pin-used)) 360deg);
  box-shadow: inset 0 0 0 4px #fff, 0 4px 12px rgba(43,52,91,.08);
}
.mg-search-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(150px, 210px) minmax(170px, 280px) auto;
}
.mg-search-row-global {
  width: min(100%, 760px);
  margin-inline: auto;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 210px) auto;
}
.mg-search-row-resource {
  grid-template-columns: minmax(180px, 1fr) auto;
}
.mg-search-results-table .mg-resource-row {
  grid-template-columns: minmax(120px, 180px) minmax(180px, 1.1fr) minmax(160px, 1fr) auto;
}
.mg-tag-picker {
  min-width: 0;
}
.mg-tag-picker-toggle {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: .35rem;
  text-align: left;
  background: rgba(255,255,255,.9);
}
.mg-tag-picker-tags {
  display: flex;
  align-items: center;
  gap: .25rem;
  min-width: 0;
  overflow: hidden;
}
.mg-search-tag {
  display: inline-flex;
  align-items: center;
  max-width: 118px;
  min-height: 20px;
  padding: .05rem .35rem;
  border: 1px solid var(--mg-border);
  background: var(--mg-surface);
  color: var(--mg-text);
  font-size: .72rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mg-tag-picker-menu {
  width: 100%;
  min-width: 100%;
  max-height: 260px;
  overflow-y: auto;
}
.mg-tag-option {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 30px;
  white-space: normal;
}
.mg-tag-option:hover {
  background: #f8f9fa;
}
.pin-toolbar {
  background: var(--mg-strong-gradient);
  border: 1px solid #9493bb;
  border-radius: 1px;
}
.btn-pin { font-size: 1rem; white-space: nowrap;padding: .25rem .5rem; border-radius: 0 !important;margin:0 .5rem; }
.mg-page-heading {
  display: grid !important;
  grid-template-columns: 96px minmax(0, 1fr) 96px;
  align-items: center !important;
  gap: .75rem !important;
  text-align: center;
}
.mg-page-heading-content {
  min-width: 0;
  justify-self: center;
}
.mg-page-heading-content > .min-w-0,
.mg-page-heading-content > div:not(.d-flex) {
  text-align: left;
}
.mg-page-back {
  width: 96px;
  justify-content: center;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  border:0px !important;
  background-color: #f6f8fe;
  gap: .35rem;
}
.mg-page-heading-spacer {
  width: 96px;
  height: 1px;
  justify-self: end;
}
.mg-privacy-banner {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 1080;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  max-width: 980px;
  margin: 0 auto;
  padding: .9rem;
  border: 1px solid rgba(37,99,235,.18);
  background: rgba(255,255,255,.96);
  box-shadow: 0 18px 60px rgba(15,23,42,.18);
  backdrop-filter: blur(14px);
}
.mg-privacy-banner__icon,
.mg-privacy-option__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  color: #fff;
  background: var(--mg-gradient2);
}
.mg-privacy-banner__body h2,
.mg-privacy-panel__header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}
.mg-privacy-banner__body p {
  margin: .15rem 0 0;
  color: var(--mg-muted);
  font-size: .86rem;
  line-height: 1.35;
}
.mg-privacy-banner__actions,
.mg-privacy-panel__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  flex-wrap: wrap;
}
.mg-privacy-primary-action {
  min-width: 118px;
  padding-inline: .85rem;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(15,23,42,.16);
}
.mg-privacy-secondary-action {
  color: var(--mg-muted);
  font-weight: 600;
  text-decoration: none;
}
.mg-privacy-secondary-action:hover {
  color: var(--mg-primary-strong);
  text-decoration: underline;
}
.mg-privacy-panel-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1090;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15,23,42,.45);
}
.mg-privacy-panel {
  width: min(720px, 100%);
  max-height: min(720px, calc(100dvh - 2rem));
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid rgba(15,23,42,.12);
  box-shadow: 0 24px 70px rgba(15,23,42,.22);
}
.mg-privacy-panel__header,
.mg-privacy-panel__footer {
  padding: .9rem 1rem;
  border-bottom: 1px solid var(--mg-border);
}
.mg-privacy-panel__footer {
  border-top: 1px solid var(--mg-border);
  border-bottom: 0;
}
.mg-privacy-panel__body {
  padding: 1rem;
  overflow-y: auto;
}
.mg-privacy-policy-link {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin: .15rem 0 .75rem;
  color: var(--mg-primary);
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none;
}
.mg-privacy-policy-link:hover {
  color: var(--mg-primary-strong);
  text-decoration: underline;
}
.impostazini-link{
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: var(--mg-text);
  font-size: 1.04rem;
  font-weight: 600;
  text-decoration: none;
}
.impostazini-link:hover{
  color: var(--mg-muted);
}
.mg-privacy-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .85rem;
  padding: .85rem 0;
  border-top: 1px solid var(--mg-border);
}
.mg-privacy-option h3 {
  margin: 0;
  font-size: .95rem;
  font-weight: 800;
}
.mg-privacy-option p {
  margin: .15rem 0 0;
  color: var(--mg-muted);
  font-size: .84rem;
  line-height: 1.35;
}
.mg-privacy-switch {
  margin: 0;
}

/* Utilities */
.shadow-100 { box-shadow: var(--mg-shadow); }
.shadow-2100 { box-shadow: var(--md-shadow); }
.border-200 { border: 1px solid var(--mg-border); }
.bg-surface { background: var(--mg-surface); }
.text-muted { color: var(--mg-muted) !important; }

/* Focus visibility per accessibilità */
:focus-visible { outline: 3px solid rgba(37,99,235,.24); outline-offset: 2px; }

/* Extra-mini controls */
.form-control-xm { font-size: .8125rem; line-height: 1.2; padding: .20rem .50rem; border-radius: 0 !important; min-height: 28px; }
.mg-pin-secret {
  -webkit-text-security: disc;
  text-security: disc;
}
textarea.form-control-xm { padding: .30rem .50rem; }
.form-select-xm { font-size: .8125rem; line-height: 1.2; padding: .20rem 1.75rem .20rem .50rem; border-radius: 0 !important; min-height: 28px; background-position: right .5rem center; }
.input-group-xm > .form-control,
.input-group-xm > .form-select,
.input-group-xm > .input-group-text,
.input-group-xm > .btn { font-size: .8125rem; padding: .20rem .50rem; border-radius: 0 !important; }
.form-check-input-xm { width: .9rem; height: .9rem; margin-top: .35rem; }
.form-check-label-xm { font-size: .8125rem; }
.btn-xm { font-size: .8125rem; padding: .25rem .55rem; border-radius: 0px; }


/* Login links sotto al box */
.login-links .link-primary { color: var(--mg-primary); }
.register-cta { font-weight: 700; text-decoration: none; font-size: 1rem; }
.register-cta:hover { text-decoration: underline; }

/* Lingue: stile bandierine/icone */
.lang-link {display: inline-flex;align-items: center;gap: .35rem;margin-right: 10px;}
/* dimensioni consigliate; adatta come preferisci */
.lang-link .lang-flag {width: 30px;height: 20px;object-fit: cover;/* facoltativo */}
/* quando selezionata: bordo “interno” 2px */
.lang-link.is-active .lang-flag {border: 2px solid var(--mg-focus);}

/* Small tweaks per form nella home */
#loginForm .form-control { padding: .625rem .75rem; }

/* Workspace applicativo */
.mg-workspace { max-width: 1440px; }
.mg-page-head { min-height: 48px; }
.mg-page-head > .d-flex > i { font-size: 1.5rem; }
.mg-panel { background: rgba(255,255,255,.94); box-shadow: var(--mg-shadow); border-radius: 4px; }
.mg-list { display: grid; gap: .5rem; }
.mg-list-item {
  width: 100%;
  display: grid;
  gap: .15rem;
  text-align: left;
  background: rgba(255,255,255,.95);
  color: var(--mg-text);
  border: 1px solid var(--mg-border);
  padding: .65rem .75rem;
}
.mg-list-item:hover,
.mg-list-item.is-active {
  border-color: var(--mg-primary);
  background: var(--mg-soft-gradient);
}
.mg-detail { display: grid; gap: .75rem; }
.mg-detail > div {
  display: grid;
  grid-template-columns: minmax(92px, 160px) 1fr;
  gap: .75rem;
  border-bottom: 1px solid var(--mg-border);
  padding-bottom: .6rem;
}
.mg-detail dt {
  font-size: .78rem;
  color: var(--mg-muted);
  font-weight: 600;
}
.mg-detail dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}
.mg-list-editor-rows {
  display: grid;
  gap: .45rem;
}
.mg-list-editor-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .45rem;
}
.mg-check-list {
  display: grid;
  gap: .45rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.mg-check-list-item label {
  display: inline-grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: .5rem;
}
.mg-check-list-item.is-reorderable {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .35rem;
  padding: .4rem .5rem;
  border: 1px solid var(--mg-border);
  background: rgba(255,255,255,.92);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.mg-check-list.is-reordering,
.mg-check-list-item.is-dragging {
  touch-action: none;
}
.mg-check-list-item.is-dragging {
  border-color: var(--mg-primary-2);
  background: var(--mg-soft-gradient);
  box-shadow: var(--mg-shadow);
  cursor: grabbing;
}
.mg-list-reorder-grip {
  color: var(--mg-muted);
  font-size: 1rem;
}
.mg-check-list-item del {
  color: var(--mg-muted);
}
.mg-drawing-field {
  display: grid;
  justify-items: center;
  min-width: 0;
}
.mg-drawing-field > .d-flex {
  width: min(85vw, 100%);
}
.mg-drawing-tools {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}
.mg-drawing-color {
  position: relative;
  overflow: hidden;
}
.mg-drawing-color input[type="color"] {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  opacity: 0;
  cursor: pointer;
}
.mg-stroke-dot {
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.mg-stroke-dot::before {
  content: "";
  width: var(--stroke-size);
  height: var(--stroke-size);
  max-width: 20px;
  max-height: 20px;
  border-radius: 50%;
  background: currentColor;
}
.mg-drawing-sheet {
  width: min(85vw, 100%);
  height: min(68vh, calc(100dvh - 230px));
  min-height: 320px;
  border: 1px solid var(--mg-border);
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.75), var(--mg-shadow);
  touch-action: none;
}
.mg-drawing-sheet canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}
.mg-drawing-preview {
  display: grid;
  justify-items: start;
  gap: .35rem;
  max-width: 100%;
}
.mg-drawing-preview img {
  width: min(85vw, 100%);
  max-height: 70vh;
  object-fit: contain;
  border: 1px solid var(--mg-border);
  background: #fff;
}
.mg-barcode-video {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  background: #111827;
  border: 1px solid var(--mg-border);
}
.mg-product-detail {
  display: grid;
  gap: .5rem;
}
.mg-product-detail-img {
  width: min(160px, 100%);
  max-height: 120px;
  object-fit: contain;
  border: 1px solid var(--mg-border);
  background: #fff;
}
.mg-empty i { font-size: 1.6rem; color: var(--mg-muted); }
.mg-dashboard-tile {
  color: var(--mg-text);
  background: rgba(255,255,255,.85);
  box-shadow: var(--mg-shadow);
  border-radius: 4px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.mg-dashboard-tile:hover {
  border-color: rgba(91,33,182,.45) !important;
  background: rgba(7,158,232,.05) !important;
  box-shadow: var(--md-shadow);
  transform: translateY(-4px);
  opacity: 1;
}
.mg-dashboard-tile > i { font-size: 1.4rem; color: var(--mg-primary); }
.mg-dashboard-install-btn {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(var(--mg-footer-height) + max(1rem, env(safe-area-inset-bottom)));
  z-index: 1025;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 42px;
  padding: .55rem .8rem;
  box-shadow: 0 16px 34px rgba(37, 99, 235, .24);
}
.mg-dashboard-install-btn i {
  font-size: 1rem;
}
.mg-donation-cta {
  max-width: 620px;
  color: var(--mg-text);
}
.mg-donation-cta p {
  font-size: .95rem;
  line-height: 1.45;
}
.mg-donation-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--mg-primary) 0%, var(--mg-primary-2) 100%);
  box-shadow: 0 14px 32px rgba(37, 99, 235, .24);
}
.mg-donation-btn:hover,
.mg-donation-btn:focus-visible {
  color: #fff;
  background: linear-gradient(135deg, var(--mg-focus) 0%, var(--mg-primary-2) 100%);
  box-shadow: 0 18px 38px rgba(37, 99, 235, .3);
}
.mg-contact-form {
  display: grid;
}
.mg-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.mg-permissions-list {
  display: grid;
  gap: .75rem;
}
.mg-permission-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem;
  border: 1px solid var(--mg-border);
  border-radius: 4px;
  background: rgba(255,255,255,.8);
}
.mg-permission-row > div:last-child {
  flex-shrink: 0;
}
.mg-permission-row i {
  color: var(--mg-primary);
}
.mg-faq-list {
  border-top: 1px solid var(--mg-border);
}
.mg-faq-list .accordion-item {
  border-color: var(--mg-border);
  border-radius: 0;
}
.mg-faq-list .accordion-button {
  font-weight: 600;
  color: var(--mg-text);
  background: rgba(255,255,255,.88);
  box-shadow: none;
}
.mg-faq-list .accordion-button:not(.collapsed) {
  color: var(--mg-primary);
  background: rgba(7,158,232,.06);
}
.mg-faq-body {
  color: var(--mg-text);
}
.mg-faq-body img,
.mg-faq-body video,
.mg-faq-body iframe {
  max-width: 100%;
  border-radius: 4px;
}
@media (max-width: 575.98px) {
  .mg-permission-row {
    align-items: stretch;
    flex-direction: column;
  }
  .mg-permission-row > div:last-child {
    justify-content: space-between;
  }
}
.mg-map {
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--mg-border);
  background: var(--mg-soft-gradient);
  border-radius: 4px;
}
.mg-map-readonly { min-height: 220px; }
@media (min-width: 768px) {
  #detailPlaceMap {
    min-height: 470px;
  }
}
.leaflet-container {
  font-family: inherit;
  color: var(--mg-text);
}

.mg-resource-app {
  min-width: 0;
}
.mg-resource-actions {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}
.mg-resource-search-status-wrap {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
  margin-left: auto;
}
.mg-resource-search-status {
    display: inline-flex;
    align-items: center;
    text-align: right;
    gap: .4rem;
    min-width: 0;
    max-width: min(100%, 520px);
    padding: .2rem .25rem .2rem .65rem;
    border-bottom: 1px solid rgba(37, 99, 235, .22);
    border-radius: 2px;
    background: rgb(248 247 254);
    color: var(--mg-primary-dark);
}
.mg-resource-search-status__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .82rem;
}
.brd-0{ border: 0 !important; }
.txt-red { color: var(--mg-danger) !important; }
.mg-icon-btn {
  width: 32px;
  min-width: 32px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
.mg-encryption-toggle-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
}
.mg-encryption-check {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}
.mg-encryption-toggle {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  min-height: 32px;
  max-width: 100%;
  margin: 0;
  color: var(--mg-text);
  font-size: .82rem;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
}
.mg-encryption-icon {
  width: 32px;
  min-width: 32px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--mg-border);
  background: rgba(255,255,255,.94);
  border-radius: 4px;
  font-size: 1rem;
}
.mg-encryption-icon-unlocked {
  color: #2563eb;
}
.mg-encryption-icon-locked {
  display: none;
  color: #7f1d1d;
}
.mg-encryption-label {
  min-width: 0;
  overflow-wrap: anywhere;
}
.mg-encryption-label-protected {
  display: none;
}
.mg-encryption-check:checked + .mg-encryption-toggle .mg-encryption-icon-unlocked {
  display: none;
}
.mg-encryption-check:checked + .mg-encryption-toggle .mg-encryption-icon-locked {
  display: inline-flex;
}
.mg-encryption-check:checked + .mg-encryption-toggle .mg-encryption-label-unprotected {
  display: none;
}
.mg-encryption-check:checked + .mg-encryption-toggle .mg-encryption-label-protected {
  display: inline;
}
.mg-encryption-check:focus-visible + .mg-encryption-toggle .mg-encryption-icon {
  outline: 2px solid var(--mg-focus);
  outline-offset: 2px;
}
.mg-encryption-check:disabled + .mg-encryption-toggle {
  cursor: not-allowed;
  opacity: .8;
}
.mg-attachment-picker {
  min-width: 0;
}
.mg-attachment-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}
.mg-attachment-trigger {
  width:150px !important;height: 32px !important;display: inline-flex;align-items: center;
  justify-content: center;gap: .35rem;text-align: left;background: rgba(255,255,255,.9);border: 1px solid var(--mg-border);
}
[data-selected-attachments] {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mg-detail-attachments {
  max-width: 100%;
}
.mg-attachment-table {
  width: 100%;
  table-layout: fixed;
  font-size:.8em;
}
.mg-attachment-table th{background: #dbe4f3; color: var(--mg-primary-dark);}
.mg-attachment-table th,
.mg-attachment-table td {
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  vertical-align: middle;
}
.mg-edit-attachment-table th:nth-child(1),
.mg-edit-attachment-table td:nth-child(1) {
  width: 48%;
}
.mg-edit-attachment-table th:nth-child(2),
.mg-edit-attachment-table td:nth-child(2) {
  width: 22%;
}
.mg-edit-attachment-table th:nth-child(3),
.mg-edit-attachment-table td:nth-child(3) {
  width: 18%;
}
.mg-edit-attachment-table th:nth-child(4),
.mg-edit-attachment-table td:nth-child(4) {
  width: 12%;
}
.mg-detail-attachments .mg-attachment-table th:nth-child(1),
.mg-detail-attachments .mg-attachment-table td:nth-child(1) {
  width: 32%;
}
.mg-detail-attachments .mg-attachment-table th:nth-child(2),
.mg-detail-attachments .mg-attachment-table td:nth-child(2) {
  width: 18%;
}
.mg-detail-attachments .mg-attachment-table th:nth-child(3),
.mg-detail-attachments .mg-attachment-table td:nth-child(3) {
  width: 14%;
}
.mg-detail-attachments .mg-attachment-table th:nth-child(4),
.mg-detail-attachments .mg-attachment-table td:nth-child(4) {
  width: 26%;
}
.mg-detail-attachments .mg-attachment-table th:nth-child(5),
.mg-detail-attachments .mg-attachment-table td:nth-child(5) {
  width: 10%;
}
.mg-extension-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  max-width: 100%;
  min-height: 24px;
  padding: .1rem .35rem;
  border: 1px solid var(--mg-border);
  background: #fff;
  border-radius: 3px;
  font-size: .78rem;
  font-weight: 600;
}
.mg-extension-badge span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.mg-attachment-preview-img {
  width: min(72px, 100%);
  height: 48px;
  object-fit: cover;
  border: 1px solid var(--mg-border);
  background: var(--mg-surface);
}
.mg-attachment-preview-media {
  width: 100%;
  min-width: 0;
  max-height: 120px;
  vertical-align: middle;
}
@media (max-width: 820px) {
  .mg-attachment-table,
  .mg-attachment-table thead,
  .mg-attachment-table tbody,
  .mg-attachment-table tr,
  .mg-attachment-table th,
  .mg-attachment-table td {
    display: block;
    width: 100% !important;
  }
  .mg-attachment-table {
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
  }
  .mg-attachment-table thead {
    display: none;
  }
  .mg-attachment-table tbody {
    display: grid;
    gap: .5rem;
  }
  .mg-attachment-table tr {
    padding: .45rem .5rem;
    border: 1px solid var(--mg-border);
    background: #fff;
    box-shadow: var(--mg-shadow);
  }
  .mg-attachment-table td {
    display: grid;
    grid-template-columns: minmax(82px, 34%) minmax(0, 1fr);
    gap: .45rem;
    padding: .18rem 0;
    border: 0;
    text-align: left !important;
  }
  .mg-attachment-table td::before {
    content: attr(data-label);
    color: var(--mg-muted);
    font-size: .74rem;
    font-weight: 700;
    line-height: 1.2;
  }
  .mg-attachment-table .mg-attachment-preview-cell {
    grid-template-columns: 1fr;
  }
  .mg-attachment-table .mg-attachment-preview-cell::before {
    margin-bottom: .15rem;
  }
  .mg-attachment-preview-img {
    width: min(100%, 180px);
    height: auto;
    max-height: 140px;
  }
  .mg-attachment-preview-media {
    width: 100%;
    max-height: 180px;
  }
}
.mg-resource-table-wrap {
  min-width: 0;
  overflow-x: hidden;
}
.mg-resource-table {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--mg-border);
  background: rgba(255,255,255,.95);
  box-shadow: var(--mg-shadow);
  border-radius: 4px;
  overflow: hidden;
}
.mg-resource-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(120px, .9fr) minmax(110px, .8fr) minmax(112px, auto);
  align-items: center;
  gap: .75rem;
  min-width: 0;
  padding: .55rem .65rem;
  border-bottom: 1px solid var(--mg-border);
}
.mg-resource-table-important .mg-resource-row {
  grid-template-columns: minmax(180px, 1.2fr) minmax(120px, .9fr) minmax(110px, .8fr) minmax(78px, 90px) minmax(112px, auto);
}
.mg-resource-row:last-child { border-bottom: 0; }
.mg-resource-row:not(.mg-resource-row-head):hover,
.mg-resource-row:not(.mg-resource-row-head):focus {
  background: linear-gradient(90deg, rgba(109,40,217,.08), rgba(14,165,233,.08));
}
.mg-resource-row-head {
  background: var(--mg-gradient);
  color: #fff;
  font-size: .78rem;
  font-weight: 700;
  min-height: 36px;
}
.mg-resource-row > div {
  min-width: 0;
}
.mg-cell-main {
  display: grid;
  gap: .1rem;
}
.mg-item-dates {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .2rem .45rem;
  font-size: .68rem;
  line-height: 1.15;
}
.mg-item-dates span {
  min-width: 0;
  white-space: nowrap;
}
.mg-date-lock {
  color: var(--mg-danger);
  font-size: calc(1em + 1px);
  line-height: 1;
  vertical-align: -0.05em;
}
.mg-cell-main span,
.mg-cell-muted {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mg-cell-tags {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: .25rem;
  flex-wrap: wrap;
}
.mg-cell-important {
  display: flex;
  align-items: center;
  justify-content: center;
}
.mg-important-toggle {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 1.15rem;
  line-height: 1;
}
.mg-important-toggle:hover,
.mg-important-toggle:focus-visible {
  color: #ca8a04;
}
.mg-important-toggle.is-important {
  color: #eab308;
}
.mg-important-toggle:disabled {
  opacity: .55;
}
.mg-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: .35rem;
  min-width: 112px;
}
.mg-modal-form {
  display: grid;
  gap: .25rem;
}
.mg-resource-modal-dialog .modal-content {
  max-height: calc(100vh - 3.5rem);
}
.mg-resource-modal-dialog .modal-body {
  min-height: 0;
  overflow-y: auto;
}
.mg-tag-field {
  min-width: 0;
}
.mg-tag-checks {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  min-width: 0;
}
.mg-tag-check-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}
.mg-tag-check-label {
  --tag-color: #111827;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  max-width: 100%;
  min-height: 30px;
  padding: .25rem .5rem;
  border: 1px solid var(--mg-border);
  background: rgba(255,255,255,.94);
  color: var(--mg-text);
  font-size: .82rem;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
}
.mg-tag-check-label:hover {
  border-color: var(--tag-color);
}
.mg-tag-check-input:checked + .mg-tag-check-label {
  border-color: var(--tag-color);
  background: color-mix(in srgb, var(--tag-color) 18%, #fff);
  box-shadow: inset 0 -2px 0 var(--tag-color);
}
.mg-tag-check-input:focus-visible + .mg-tag-check-label {
  outline: 2px solid var(--mg-focus);
  outline-offset: 2px;
}
.mg-tag-dot {
  width: .7rem;
  height: .7rem;
  flex: 0 0 .7rem;
  border: 1px solid rgba(17,24,39,.25);
  background: var(--tag-color);
}
.mg-category-create-row,
.mg-category-manager-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}
.mg-category-modal-dialog .modal-body {
  min-height: 0;
  overflow-y: auto;
}
.mg-category-modal-dialog .modal-content {
  max-height: calc(100vh - 3.5rem);
}
.mg-category-create-row {
  align-items: end;
  flex-wrap: wrap;
}
.mg-category-create-row .flex-grow-1 {
  flex: 0 1 32rem;
  max-width: 55rem;
}
.mg-category-color-field {
  width: 4.25rem;
}
.mg-category-create-row .btn {
  margin-left: 1rem;
}
.mg-category-manager {
  display: grid;
  gap: .5rem;
}
.mg-category-manager-row {
  padding: .45rem;
  border: 1px solid var(--mg-border);
  background: rgba(255,255,255,.78);
}
.mg-category-manager-row .form-control-xm {
  min-width: 0;
}
.mg-category-manager-row .form-control-color {
  flex: 0 0 3.25rem;
}
@media (max-width: 575.98px) {
  .mg-category-create-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }
  .mg-category-create-row .flex-grow-1 {
    grid-column: 1 / -1;
    max-width: none;
  }
  .mg-category-create-row .btn {
    margin-left: 0;
    min-height: 38px;
  }
  .mg-category-color-field {
    width: auto;
  }
  .mg-category-manager-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: .55rem;
    padding: .6rem;
  }
  .mg-category-manager-row .form-control-color {
    grid-column: 2 / -1;
    width: 100%;
  }
  .mg-category-manager-row .mg-icon-btn {
    min-width: 38px;
    min-height: 38px;
  }
  .mg-category-modal-dialog .modal-content {
    max-height: 100vh;
  }
}
.mg-keyword-field {
  min-width: 0;
}
.mg-keyword-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .35rem;
  min-height: 34px;
  padding: .25rem .4rem;
  border: 1px solid var(--mg-border);
  background: rgba(255,255,255,.96);
  border-radius: 3px;
}
.mg-keyword-box:focus-within {
  border-color: var(--mg-focus);
  outline: 0;
  box-shadow: 0 0 0 .2rem rgba(37,99,235,.12);
}
.mg-keyword-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: .3rem;
  min-width: 0;
}
.mg-keyword-tag {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  max-width: 100%;
  min-height: 24px;
  padding: .1rem .25rem .1rem .45rem;
  border: 1px solid var(--mg-border);
  background: linear-gradient(135deg, rgba(109,40,217,.12), rgba(14,165,233,.12));
  color: var(--mg-primary-dark);
  font-size: .8rem;
  line-height: 1.2;
  border-radius: 3px;
}
.mg-keyword-tag span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mg-keyword-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mg-muted);
}
.mg-keyword-remove:hover {
  color: var(--mg-text);
}
.mg-keyword-input {
  flex: 1 1 130px;
  min-width: 120px;
  height: 24px;
  border: 0;
  outline: 0;
  font-size: .8125rem;
  line-height: 1.2;
}
.mg-scroll-sentinel {
  width: 100%;
  height: 1px;
}
.mg-masked {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 22px;
  padding: .05rem .4rem;
  border: 1px solid var(--mg-border);
  background: repeating-linear-gradient(135deg, #eef2ff 0, #eef2ff 4px, #dbeafe 4px, #dbeafe 8px);
  color: var(--mg-muted);
  font-size: .78rem;
  font-weight: 600;
}

@media (max-width: 575.98px) {
  .app-container {
    box-sizing: border-box;
    min-height: 100dvh;
    padding-top: var(--mg-mobile-header-height);
    padding-bottom: var(--mg-mobile-footer-height);
  }
  .app-container > header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: var(--mg-mobile-header-height);
    z-index: 1030;
  }
  .mg-app-toolbar {
    top: var(--mg-mobile-header-height);
    z-index: 1020;
  }
  .mg-floating-search-btn {
    top: var(--mg-search-launcher-top, calc(var(--mg-mobile-header-height) + 72px));
    right: .8rem;
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 50% !important;
  }
  .mg-floating-search-btn span {
    display: none;
  }
  .memoget-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: var(--mg-mobile-footer-height);
    z-index: 1030;
  }
  .memoget-footer nav {
    min-height: var(--mg-mobile-footer-height);
  }
  .mg-toolbar-row,
  .mg-search-row {
    grid-template-columns: 1fr;
  }
  .mg-search-row-global,
  .mg-search-row-resource,
  .mg-search-results-table .mg-resource-row {
    grid-template-columns: 1fr;
  }
  .mg-toolbar-row,
  .mg-pin-actions {
    align-items: stretch;
  }
  .mg-page-heading {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    gap: .5rem !important;
  }
  .mg-page-back {
    width: 36px;
    padding-left: 0;
    padding-right: 0;
  }
  .mg-page-back span {
    display: none;
  }
  .mg-page-heading-spacer {
    width: 36px;
  }
  .mg-privacy-banner {
    grid-template-columns: 1fr;
    align-items: stretch;
    left: .75rem;
    right: .75rem;
    bottom: calc(var(--mg-mobile-footer-height) + .75rem);
  }
  .mg-privacy-banner__icon {
    display: none;
  }
  .mg-privacy-banner__actions,
  .mg-privacy-panel__footer {
    display: grid;
    grid-template-columns: 1fr;
  }
  .mg-privacy-option {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .mg-privacy-switch {
    grid-column: 2;
    justify-self: start;
  }
  .mg-dashboard-install-btn {
    right: max(.75rem, env(safe-area-inset-right));
    bottom: calc(var(--mg-mobile-footer-height) + max(.75rem, env(safe-area-inset-bottom)));
    min-height: 38px;
    padding: .45rem .65rem;
  }
  .mg-dashboard-install-btn span {
    display: none;
  }
  .mg-pin-actions .btn,
  .mg-search-row .btn {
    width: 100%;
    margin-left: 0 !important;
  }
  .mg-detail > div { grid-template-columns: 1fr; gap: .2rem; }
  .mg-map { min-height: 240px; }
  .mg-resource-actions .btn:not(.mg-icon-btn) {
    flex: 1 1 140px;
  }
  .mg-resource-search-status-wrap {
    flex: 1 1 100%;
    justify-content: stretch;
    margin-left: 0;
  }
  .mg-resource-search-status {
    width: 100%;
    max-width: 100%;
  }
  .mg-resource-row-head {
    display: none;
  }
  .mg-resource-table {
    border: 0;
    box-shadow: none;
    background: transparent;
  }
  .mg-resource-row {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main actions"
      "meta actions"
      "tags actions";
    gap: .25rem .5rem;
    margin-bottom: .5rem;
    border: 1px solid var(--mg-border);
    background: #fff;
    box-shadow: var(--mg-shadow);
  }
  .mg-resource-row .mg-cell-main { grid-area: main; }
  .mg-resource-row .mg-cell-muted { grid-area: meta; font-size: .8rem; }
  .mg-resource-row .mg-cell-tags { grid-area: tags; }
  .mg-resource-row .mg-row-actions {
    grid-area: actions;
    min-width: 32px;
    flex-direction: column;
    align-self: stretch;
    justify-content: center;
  }
  .mg-resource-table-important .mg-resource-row {
    grid-template-columns: minmax(0, 1fr) 34px auto;
    grid-template-areas:
      "main . actions"
      "meta . actions"
      "tags important actions";
  }
  .mg-resource-row .mg-cell-important {
    grid-area: important;
    align-self: center;
  }
  .mg-resource-row .mg-icon-btn {
    width: 34px;
    min-width: 34px;
  }
}

/* Modern theme refinements */
.form-control-xm,
.form-select-xm,
.input-group-xm > .form-control,
.input-group-xm > .form-select,
.input-group-xm > .input-group-text,
.input-group-xm > .btn,
.btn-xm {
  border-radius: 0px;
} 

.modal-header {
  background: var(--mg-soft-gradient);
  border-bottom-color: rgba(219,228,243,.85);
}

.modal-footer {
  background: #fbfdff;
  border-top-color: rgba(219,228,243,.85);
}

.dropdown-item:active,
.dropdown-item:hover {
  background: var(--mg-soft-gradient);
  color: var(--mg-primary-dark);
}

.table {
  --bs-table-hover-bg: rgba(109,40,217,.06);
  --bs-table-border-color: var(--mg-border);
}

.badge.text-bg-light,
.mg-search-tag,
.mg-color-badge {
  border-radius: 1.5px;
}

.mg-page-head {
  color: var(--mg-primary-dark);
}

.mg-page-head > .d-flex > i {
  color: var(--mg-primary);
}

.mg-resource-actions .btn-dark,
.mg-pin-form .btn-dark,
.mg-search-row .btn-dark {
  min-height: 30px;
}

.mg-resource-row:not(.mg-resource-row-head) {
  transition: background .18s ease, transform .18s ease;
}

.mg-resource-row:not(.mg-resource-row-head):hover {
  transform: translateY(-1px);
}

.mg-icon-btn {
  border-radius: 3px !important;
}

.mg-audio-recorder {
  padding: .65rem;
  border: 1px solid rgba(219,228,243,.95);
  border-radius: 4px;
  background: linear-gradient(135deg, rgba(255,255,255,.96), rgba(239,246,255,.82));
}

.mg-empty {
  border-radius: 4px;
  background: rgba(255,255,255,.9) !important;
  box-shadow: var(--mg-shadow);
}

.mg-offline-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(15, 23, 42, .18);
  color: #141414;
  text-align: center;
  backdrop-filter: blur(2px);
}

.mg-offline-overlay.is-visible {
  display: flex;
}

.mg-offline-message {
  display: grid;
  justify-items: center;
  gap: .85rem;
  max-width: min(420px, 100%);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
}

.mg-offline-message i {
  color: #dc2626;
  font-size: clamp(3.25rem, 13vw, 5.5rem);
  line-height: 1;
}

.mg-pin-step {
  transition: opacity .18s ease, filter .18s ease;
}

.mg-pin-step.is-disabled {
  opacity: .42;
  filter: grayscale(.25);
}

.mg-pin-step.is-disabled input,
.mg-pin-step.is-disabled button {
  pointer-events: none;
}
